aboutsummaryrefslogtreecommitdiff
path: root/p/scripts
diff options
context:
space:
mode:
authorGravatar Offerel <14041522+Offerel@users.noreply.github.com> 2021-12-31 13:14:15 +0100
committerGravatar GitHub <noreply@github.com> 2021-12-31 13:14:15 +0100
commitf905ad772ef577879c5abb3a2e1e137986b45eee (patch)
treecc90fa23aecc47436c12f65df5f666d658653eb7 /p/scripts
parentf13ef3b102e2724367572f37a1fc57400b443280 (diff)
Check data URI (#4098)
* Check data URI
Diffstat (limited to 'p/scripts')
-rw-r--r--p/scripts/main.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js
index 3093d1da8..21420872f 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -1661,8 +1661,11 @@ function faviconNbUnread(n) {
ctx.fillText(text, 0, canvas.height - 1);
}
link.href = canvas.toDataURL('image/png');
- document.querySelector('link[rel~=icon]').remove();
- document.head.appendChild(link);
+ // Check if data URI has generated a real favicon and if not, fallback to standard icon
+ if (link.href.length > 180) {
+ document.querySelector('link[rel~=icon]').remove();
+ document.head.appendChild(link);
+ }
};
img.src = '../favicon.ico';
}