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:
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.
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 test_data/ icon.svg: text/plain
src/testing/
under Ubuntu 18.04 the library has been updated and works well:
$ file --mime-type /tmp/squashfs- root/meta/ gui/icon. svg root/meta/ gui/icon. svg: image/svg
/tmp/squashfs-
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.