fix: try better handling of protocolless urls.
This commit is contained in:
parent
98a9ae660d
commit
ef72a2ce9d
|
@ -29,7 +29,9 @@ export default class URLRewriteFilter implements ContentFilter {
|
||||||
let attrName = ["a", "link"].includes(tag) ? "href" : "src";
|
let attrName = ["a", "link"].includes(tag) ? "href" : "src";
|
||||||
let urlValue = $(element).attr(attrName);
|
let urlValue = $(element).attr(attrName);
|
||||||
if (urlValue) {
|
if (urlValue) {
|
||||||
const isExternal = urlValue.startsWith("http");
|
const isExternal =
|
||||||
|
urlValue.startsWith("http") ||
|
||||||
|
(urlValue.startsWith("//") && isICANN(urlValue));
|
||||||
if (!isExternal || !isICANN(urlValue)) {
|
if (!isExternal || !isICANN(urlValue)) {
|
||||||
if (!isExternal) {
|
if (!isExternal) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
|
|
Loading…
Reference in New Issue