RealFaviconGenerator / realfavicongenerator

Generate favicon for all major platforms
505 stars 23 forks source link

Checker does not deduce base URL correctly for webmanifest containing URL parameters #464

Open bertvandepoel opened 3 years ago

bertvandepoel commented 3 years ago

When using relative URL icons in the web manifest JSON, I've noticed that if the link to that JSON contains a URL parameter, the checker incorrectly parses the base URL. For example in the application rainloop has <link rel="manifest" href="rainloop/v/1.16.0/static/manifest.json?community"/> which contains:

{
    "name": "RainLoop Webmail",
    "short_name": "RainLoop",
    "description": "Simple, modern & fast web-based email client",
    "display": "standalone",
    "icons": [{
        "src": "apple-touch-icon.png",
        "sizes": "64x64",
        "type": "image/png"
    }, {
        "src": "android-icon.png",
        "sizes": "192x192",
        "type": "image/png"
    }],
    "start_url": "../../../../"
}

Strangely enough, the realfavicongenerator checker then looks for the icons on /rainloop/v/1.16.0/static/manifest.json?community/apple-touch-icon.png and /rainloop/v/1.16.0/static/manifest.json?community/android-icon.png. That's clearly a bug of course. I've tested it in detail on Android and there it actually behaves perfectly on both Chrome and Firefox for Android.

It seems the checker is just looking for a json file to remove and is confused by the URL parameters. I suggest in the code those should first be stripped before looking for the file to remove. That way it should work the same way as mobile browsers do it.