From 2cfa5511d5dbd9007a07f3f9b760439e7bbac632 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Mon, 10 Jul 2023 15:56:59 +0200 Subject: [PATCH] Do not require applink icons to be pngs --- src/applinks.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/applinks.js b/src/applinks.js index 53098b34f..b7f48549e 100644 --- a/src/applinks.js +++ b/src/applinks.js @@ -88,9 +88,9 @@ async function detectMetaInfo(applink) { if (!applink.icon) { let favicon = ''; if (dom.window.document.querySelector('link[rel="apple-touch-icon"]')) favicon = dom.window.document.querySelector('link[rel="apple-touch-icon"]').href ; - if (!favicon.endsWith('.png') && dom.window.document.querySelector('meta[name="msapplication-TileImage"]')) favicon = dom.window.document.querySelector('meta[name="msapplication-TileImage"]').content ; - if (!favicon.endsWith('.png') && dom.window.document.querySelector('link[rel="shortcut icon"]')) favicon = dom.window.document.querySelector('link[rel="shortcut icon"]').href ; - if (!favicon.endsWith('.png') && dom.window.document.querySelector('link[rel="icon"]')) { + if (!favicon && dom.window.document.querySelector('meta[name="msapplication-TileImage"]')) favicon = dom.window.document.querySelector('meta[name="msapplication-TileImage"]').content ; + if (!favicon && dom.window.document.querySelector('link[rel="shortcut icon"]')) favicon = dom.window.document.querySelector('link[rel="shortcut icon"]').href ; + if (!favicon && dom.window.document.querySelector('link[rel="icon"]')) { let iconElements = dom.window.document.querySelectorAll('link[rel="icon"]'); if (iconElements.length) { favicon = iconElements[0].href; // choose first one for a start @@ -104,7 +104,7 @@ async function detectMetaInfo(applink) { if (iconElements.length) favicon = iconElements[0].href; } } - if (!favicon.endsWith('.png') && dom.window.document.querySelector('meta[itemprop="image"]')) favicon = dom.window.document.querySelector('meta[itemprop="image"]').content; + if (!favicon && dom.window.document.querySelector('meta[itemprop="image"]')) favicon = dom.window.document.querySelector('meta[itemprop="image"]').content; if (favicon) { favicon = new URL(favicon, redirectUri || applink.upstreamUri).toString();