From c7f3ffa2c18b00cfcf7fd4323685e9854de443dd Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 18 Nov 2023 09:07:31 -0500 Subject: [PATCH] fix: handle absolute relative paths --- src/backend/filters/urlRewrite.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/filters/urlRewrite.ts b/src/backend/filters/urlRewrite.ts index d99efb2..0c8b333 100644 --- a/src/backend/filters/urlRewrite.ts +++ b/src/backend/filters/urlRewrite.ts @@ -33,7 +33,7 @@ export default class URLRewriteFilter implements ContentFilter { urlValue.startsWith("http") || (urlValue.startsWith("//") && isICANN(urlValue)); if (!isExternal || !isICANN(urlValue)) { - if (!isExternal) { + if (!isExternal && !urlValue.startsWith("/")) { //@ts-ignore urlValue = path.join(rUrl.pathname, urlValue); } @@ -53,7 +53,7 @@ export default class URLRewriteFilter implements ContentFilter { url.startsWith("http") || (url.startsWith("//") && isICANN(url)); if (!isExternal || !isICANN(url)) { - if (!isExternal) { + if (!isExternal && !url.startsWith("/")) { //@ts-ignore url = path.join(rUrl.pathname, url); }