mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2025-12-15 23:20:26 -08:00
Fix ICO icon is retrieved from Guardian instead of PNG icon (#178)
This commit is contained in:
parent
2bdbc7b4b5
commit
d05974e0dd
1 changed files with 6 additions and 3 deletions
|
|
@ -20,9 +20,12 @@ const getWebsiteIconUrlAsync = (websiteURL) => customizedFetch(websiteURL)
|
|||
// find the icon with largest size
|
||||
rootElm.each((i, _elm) => {
|
||||
const elm = $(_elm);
|
||||
// make sure icon is png
|
||||
if (elm.attr('type') === 'image/png'
|
||||
|| elm.attr('href').endsWith('.png')) {
|
||||
// check if type is PNG
|
||||
// also check to make sure links doesn't end with .ico
|
||||
// as some websites specify icon type wrong
|
||||
// see https://github.com/atomery/webcatalog/issues/630 for more details
|
||||
if ((elm.attr('type') === 'image/png' && !elm.attr('href').endsWith('.ico'))
|
||||
|| elm.attr('href').endsWith('.png')) { // if type is not specified but link ends with .png then assumes that the icon is PNG
|
||||
const size = elm.attr('sizes') ? parseInt(elm.attr('sizes').split('x'), 10) : 0;
|
||||
if (size >= maxSize) {
|
||||
maxSize = size;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue