diff --git a/src/backend/filters/urlRewrite.ts b/src/backend/filters/urlRewrite.ts
index a884aeb..ea88f8d 100644
--- a/src/backend/filters/urlRewrite.ts
+++ b/src/backend/filters/urlRewrite.ts
@@ -13,13 +13,6 @@ export default class URLRewriteFilter implements ContentFilter {
const $ = cheerio.load(html);
- // Insert or adjust the tag
- if ($("base").length) {
- $("base").attr("href", "/browse/");
- } else {
- $("head").prepend('');
- }
-
["a", "link", "script", "img"].forEach((tag) => {
$.root()
.find(tag)
@@ -27,10 +20,8 @@ export default class URLRewriteFilter implements ContentFilter {
let attrName = ["a", "link"].includes(tag) ? "href" : "src";
let urlValue = $(element).attr(attrName);
if (urlValue) {
- if (!isICANN(urlValue)) {
- if (urlValue.startsWith("http")) {
- $(element).attr(attrName, `/browse${urlValue}`);
- }
+ if (urlValue.startsWith("http") && !isICANN(urlValue)) {
+ $(element).attr(attrName, `/browse${urlValue}`);
}
}
});