fix: handle protocolless urls

This commit is contained in:
Derrick Hammer 2023-10-16 20:13:24 -04:00
parent 02c2a59938
commit cf826dce82
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 0 deletions

View File

@ -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;