Bugfix: do not convert base64 and non-http(s)://

This commit is contained in:
DarkCat09 2023-09-22 13:37:17 +04:00
parent d0d3dfd7b9
commit 3a8198ea14
No known key found for this signature in database
GPG Key ID: 0A26CD5B3345D6E3

View File

@ -10,16 +10,18 @@ export default function replaceHref(
) { ) {
const doc = dom.window.document; const doc = dom.window.document;
const parserUrl = (href: string) => generateParserUrl( const parserUrl = (href: string) =>
href.startsWith("http") ? generateParserUrl(
requestUrl, requestUrl,
href, href,
engine, engine,
redirectPath, redirectPath,
); ) : href;
const proxyUrl = (href: string) => generateProxyUrl( const proxyUrl = (href: string) =>
href.startsWith("http") ? generateProxyUrl(
requestUrl, requestUrl,
href, href,
); ) : href;
modifyLinks( modifyLinks(
doc.getElementsByTagName("a"), doc.getElementsByTagName("a"),
@ -58,6 +60,7 @@ export default function replaceHref(
const parts = src.trim().split(" "); const parts = src.trim().split(" ");
try { try {
// first part is URL // first part is URL
// (srcset="http 200w 1x,...")
parts[0] = proxyUrl(parts[0]); parts[0] = proxyUrl(parts[0]);
} catch (_err) { } } catch (_err) { }
// join by space after splitting // join by space after splitting