Comment 7 for bug 1871486

Revision history for this message
Daniel Manrique (roadmr) wrote :

The plot thickens -

the problem is not python-magic but the underlying libmagic which also powers the "file" command - on Xenial (which is the platform the store runs under), the given svg *IS* detected as text/plain:

$ file --mime-type src/testing/test_data/icon.svg
src/testing/test_data/icon.svg: text/plain

under Ubuntu 18.04 the library has been updated and works well:

$ file --mime-type /tmp/squashfs-root/meta/gui/icon.svg
/tmp/squashfs-root/meta/gui/icon.svg: image/svg

we cannot use Python's mimetypes library for two reasons: it can't operate on file-like objects, it requires an actual file; and, the reason it requires an actual file is because its type guessing is based on file extension, which is error-prone.