fix: improve rewrites

This commit is contained in:
Derrick Hammer 2023-10-16 21:59:19 -04:00
parent 03595ac3de
commit 238195ad98
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 3 deletions

View File

@ -21,10 +21,12 @@ export default class URLRewriteFilter implements ContentFilter {
if (urlValue) {
if (!isICANN(urlValue)) {
if (urlValue.startsWith("/")) {
if (
urlValue.startsWith("/") ||
urlValue.startsWith("../") ||
urlValue.startsWith("http")
) {
$(element).attr(attrName, `/browse${urlValue}`);
} else if (urlValue.startsWith("http")) {
$(element).attr(attrName, `/browse/${urlValue}`);
}
}
}