# Icon Type is Incorrectly Reported in manifest.json for Android

**URL:** <https://meta.discourse.org/t/icon-type-is-incorrectly-reported-in-manifest-json-for-android/71961>\
**Category:** Bug\
**Created:** [October 12, 2017, 8:59pm UTC](https://meta.discourse.org/t/icon-type-is-incorrectly-reported-in-manifest-json-for-android/71961 "2017-10-12T20:59:41Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![FelicianoTech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/felicianotech/32/120007_2.png) [@FelicianoTech](https://meta.discourse.org/u/FelicianoTech)\
**Post date:** [October 12, 2017, 8:59pm UTC](https://meta.discourse.org/t/icon-type-is-incorrectly-reported-in-manifest-json-for-android/71961/1 "2017-10-12T20:59:42Z")

</div>

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`.

Examples of Discourse sites with this problem:

- Chef - [main site](https://discourse.chef.io/)/[manifest](https://discourse.chef.io/manifest.json)
- Write the Docs - [main site](http://forum.writethedocs.org/)/[manifest](http://forum.writethedocs.org/manifest.json)

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [October 12, 2017, 10:17pm UTC](https://meta.discourse.org/t/icon-type-is-incorrectly-reported-in-manifest-json-for-android/71961/2 "2017-10-12T22:17:17Z")

</div>

Where is the `manifest.json` file used?

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [October 12, 2017, 10:28pm UTC](https://meta.discourse.org/t/icon-type-is-incorrectly-reported-in-manifest-json-for-android/71961/3 "2017-10-12T22:28:24Z")

</div>

I think the android pretend web page is app feature uses this: [How to provide your own in-app install experience &nbsp;|&nbsp; web.dev](https://developers.google.com/web/updates/2014/11/Support-for-installable-web-apps-with-webapp-manifest-in-chrome-38-for-Android)

---

<div class="post-metadata">

**Author:** ![FelicianoTech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/felicianotech/32/120007_2.png) [@FelicianoTech](https://meta.discourse.org/u/FelicianoTech)\
**Post date:** [October 13, 2017, 2:12am UTC](https://meta.discourse.org/t/icon-type-is-incorrectly-reported-in-manifest-json-for-android/71961/4 "2017-10-13T02:12:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [May 5, 2018, 8:36pm UTC](https://meta.discourse.org/t/icon-type-is-incorrectly-reported-in-manifest-json-for-android/71961/5 "2018-05-05T20:36:20Z")

</div>

Is this still an issue @featheredtoast?

---

<div class="post-metadata">

**Author:** ![featheredtoast](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/featheredtoast/32/116994_2.png) [@featheredtoast](https://meta.discourse.org/u/featheredtoast)\
**Post date:** [May 5, 2018, 8:58pm UTC](https://meta.discourse.org/t/icon-type-is-incorrectly-reported-in-manifest-json-for-android/71961/6 "2018-05-05T20:58:36Z")

</div>

I haven’t made any changes to the manifest during my time in serviceworker land, but I’ll check it out

---

<div class="post-metadata">

**Author:** ![FelicianoTech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/felicianotech/32/120007_2.png) [@FelicianoTech](https://meta.discourse.org/u/FelicianoTech)\
**Post date:** [May 7, 2018, 1:38am UTC](https://meta.discourse.org/t/icon-type-is-incorrectly-reported-in-manifest-json-for-android/71961/8 "2018-05-07T01:38:37Z")

</div>

This is still an issue as of Discourse `2.0.0.beta7`. Can be seen here: [https://forums.theanimenetwork.com/manifest.json](https://forums.theanimenetwork.com/manifest.json)

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [May 7, 2018, 1:48am UTC](https://meta.discourse.org/t/icon-type-is-incorrectly-reported-in-manifest-json-for-android/71961/9 "2018-05-07T01:48:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![featheredtoast](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/featheredtoast/32/116994_2.png) [@featheredtoast](https://meta.discourse.org/u/featheredtoast)\
**Post date:** [May 17, 2018, 7:18pm UTC](https://meta.discourse.org/t/icon-type-is-incorrectly-reported-in-manifest-json-for-android/71961/10 "2018-05-17T19:18:36Z")

</div>

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:

[https://github.com/discourse/discourse/commit/41ffafb65e4fc9a305e35b900d689f15cf0f3890](https://github.com/discourse/discourse/commit/41ffafb65e4fc9a305e35b900d689f15cf0f3890)

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [May 17, 2018, 8:04pm UTC](https://meta.discourse.org/t/icon-type-is-incorrectly-reported-in-manifest-json-for-android/71961/11 "2018-05-17T20:04:32Z")

</div>

Is there a way to check if the file exists in the uploads table?

I believe in most cases it will be there and we can get extension and size from there.

---

<div class="post-metadata">

**Author:** ![featheredtoast](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/featheredtoast/32/116994_2.png) [@featheredtoast](https://meta.discourse.org/u/featheredtoast)\
**Post date:** [May 17, 2018, 8:05pm UTC](https://meta.discourse.org/t/icon-type-is-incorrectly-reported-in-manifest-json-for-android/71961/12 "2018-05-17T20:05:32Z")

</div>

Oh good point, let me see what I can do there.

* * *

Utilizing the mini-mime lib properly now.

I also attempts to use thesize dimensions if they exist in an upload as well. 🍒

[https://github.com/discourse/discourse/commit/04c7dbafa32991836a688e979e03b117e8ec8c19](https://github.com/discourse/discourse/commit/04c7dbafa32991836a688e979e03b117e8ec8c19)

---

<div class="post-metadata">

**Author:** ![featheredtoast](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/featheredtoast/32/116994_2.png) [@featheredtoast](https://meta.discourse.org/u/featheredtoast)\
**Post date:** [May 22, 2018, 1:00am UTC](https://meta.discourse.org/t/icon-type-is-incorrectly-reported-in-manifest-json-for-android/71961/13 "2018-05-22T01:00:09Z")

</div>

This topic was automatically closed after 4 days. New replies are no longer allowed.
