From cf826dce82c34a862cdcee9ef6a1456adad8ab3b Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Mon, 16 Oct 2023 20:13:24 -0400 Subject: [PATCH] fix: handle protocolless urls --- src/backend/filters/urlRewrite.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/backend/filters/urlRewrite.ts b/src/backend/filters/urlRewrite.ts index 77c3963..c4bfee5 100644 --- a/src/backend/filters/urlRewrite.ts +++ b/src/backend/filters/urlRewrite.ts @@ -38,6 +38,9 @@ export default class URLRewriteFilter implements ContentFilter { } function isICANN(url: string) { + if (url.startsWith("//")) { + url = `https:${url}`; + } try { const parsedUrl = new URL(url); const domain = parsedUrl.hostname;