The discussion addresses an issue where the manifest.json file in Discourse sites incorrectly reports the icon type as image/png regardless of the actual file format (e.g., ICO, JPEG, SVG). Users FelicianoTech, codinghorror, and sam identify that this affects Android’s “Save to Homescreen” feature and other web app implementations. FelicianoTech confirms the issue persists in Discourse 2.0.0.beta7. Falco suggests using large icon url as a workaround but notes it may break the add-to-homescreen banner. featheredtoast acknowledges the issue and implements fixes by improving mime type detection from filenames and upload metadata, including size and dimensions, via commits 41ffafb and 04c7dbaf.
In every Discourse site’s manifest.json file, a list of icons are shown. For each icon, a “type” is provided which looks to be the icon’s mime type. Problem is, regardless of which format the icon actually is (ico, jpeg, svg), the provided type is image/png.
Yup - the file mainly supports the Android “Save to Homescreen” feature which then opens up that site as an app (Chrome WebView).
Other software projects nowadays rely on that file as well for their own webapp needs. Such as when Ubuntu had Unity Webapps which allows a saved site to have their own icon in the Unity Launcher.
I wouldn’t be surprised if more sites use that file, though I can’t personally list anymore.
The easiest fix is only using large icon url there. However most Discourse instances doesn’t fill this field and will lose the add to homescreen banner then.
It’s not perfect without downloading and inspecting the file itself, but I’ve added a “best effort” educated guess at figuring out the mime type from the filename alone which should resolve the common cases: