diff --git a/packages/metascraper-logo-favicon/src/index.js b/packages/metascraper-logo-favicon/src/index.js
index eaf632e47..b5bdb9389 100644
--- a/packages/metascraper-logo-favicon/src/index.js
+++ b/packages/metascraper-logo-favicon/src/index.js
@@ -78,7 +78,7 @@ const getDomNodeSizes = (domNodes, attr, url) =>
{
...domNode.attribs,
url: normalizedUrl,
- size: getSize(url, domNode.attribs.sizes)
+ size: getSize(normalizedUrl, domNode.attribs.sizes)
}
]
}, [])
@@ -163,8 +163,8 @@ const createFavicon = (
const faviconUrl = logo(`/favicon.${ext}`, { url })
return faviconUrl
? resolveFaviconUrl(faviconUrl, contentTypes, gotOpts).then(
- response => response?.url
- )
+ response => response?.url
+ )
: undefined
}
}
diff --git a/packages/metascraper-logo-favicon/test/index.js b/packages/metascraper-logo-favicon/test/index.js
index de5e8eb3b..5b82d1726 100644
--- a/packages/metascraper-logo-favicon/test/index.js
+++ b/packages/metascraper-logo-favicon/test/index.js
@@ -85,6 +85,17 @@ test('get the biggest icon possible', async t => {
t.is(metadata.logo, 'https://cdn.microlink.io/logo/favicon-196x196.png')
})
+test('prefers small png over large ico', async t => {
+ const url = 'https://github.com'
+ const metascraper = createMetascraper()
+ const html = createHtml([
+ '',
+ ''
+ ])
+ const metadata = await metascraper({ url, html })
+ t.is(metadata.logo, 'https://github.com/fluidicon.png')
+})
+
test('detect `rel="fluid-icon"`', async t => {
const url = 'https://github.com'
const metascraper = createMetascraper()