mirror of
https://github.com/txtdot/txtdot
synced 2024-10-18 14:40:19 +03:00
Bugfix: do not convert base64 and non-http(s)://
This commit is contained in:
parent
d0d3dfd7b9
commit
3a8198ea14
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user