fix: try better handling of protocolless urls.

This commit is contained in:
Derrick Hammer 2023-10-18 08:43:58 -04:00
parent 98a9ae660d
commit ef72a2ce9d
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 1 deletions

View File

@ -29,7 +29,9 @@ export default class URLRewriteFilter implements ContentFilter {
let attrName = ["a", "link"].includes(tag) ? "href" : "src";
let urlValue = $(element).attr(attrName);
if (urlValue) {
const isExternal = urlValue.startsWith("http");
const isExternal =
urlValue.startsWith("http") ||
(urlValue.startsWith("//") && isICANN(urlValue));
if (!isExternal || !isICANN(urlValue)) {
if (!isExternal) {
//@ts-ignore