Fix bug with data urls attempting to route to the favicon proxy.
This commit is contained in:
parent
e54858620b
commit
f5fdaf32e6
1 changed files with 12 additions and 6 deletions
|
|
@ -227,15 +227,21 @@
|
||||||
(iframe.contentDocument.querySelector("link[rel='icon']") as HTMLLinkElement) ||
|
(iframe.contentDocument.querySelector("link[rel='icon']") as HTMLLinkElement) ||
|
||||||
(iframe.contentDocument.querySelector("link[rel*='icon']") as HTMLLinkElement);
|
(iframe.contentDocument.querySelector("link[rel*='icon']") as HTMLLinkElement);
|
||||||
if (favicon && favicon.href) {
|
if (favicon && favicon.href) {
|
||||||
if (
|
let encodedHREF = encodeURIComponent(favicon.href);
|
||||||
proxiedFavicon.src ==
|
if (favicon.href.includes("data:image")) {
|
||||||
`${window.location.origin}/custom-favicon?url=${encodeURIComponent(favicon.href)}` ||
|
proxiedFavicon.src = favicon.href;
|
||||||
hasErrored
|
return;
|
||||||
)
|
}
|
||||||
|
if (proxiedFavicon.src == `${window.location.origin}/custom-favicon?url=${encodedHREF}`)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (favicon) {
|
if (favicon) {
|
||||||
proxiedFavicon.src = `/custom-favicon?url=${encodeURIComponent(favicon.href)}`;
|
let encodedHREF = encodeURIComponent(favicon.href);
|
||||||
|
if (favicon.href.includes("data:image")) {
|
||||||
|
proxiedFavicon.src = favicon.href;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
proxiedFavicon.src = `/custom-favicon?url=${encodedHREF}`;
|
||||||
proxiedFavicon.addEventListener("error", () => {
|
proxiedFavicon.addEventListener("error", () => {
|
||||||
proxiedFavicon.src = "/favicon.ico";
|
proxiedFavicon.src = "/favicon.ico";
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue