When I download SVG images from this page iso-country-flags-svg-collection/svg/country-4x3 at master · joielechong/iso-country-flags-svg-collection · GitHub
I have problem to see some icons in nautilus folder and also same icon can’t be loaded in C/C++ own program which use gtkmm library. I use fresh Debian trixie. I can’t say if is problem with images or with library but some programs like Inkscape or Gimp can open this icons.
This is due to content type being detected as:
application/xml
instead of
image/svg+xml
This is caused when there is lot of comments in the initial section of the SVG file (hence only a few of the SVG files have issues).
Following g_content_type_guess()
usage in gdk-pixbuf/gdk-pixbuf-io.c#L899-903, sniffs content first, and when there is lot of comments in the initial section of the SVG file, GIO (xdg-mime
) declares it’s 100% sure it’s application/xml
, and gdk-pixbuf
thinks it’s an XML file, and fails to find an image loader.
GIO file info querying gets it correct though.
$ gio info svg/country-4x3/ae.svg | grep content
standard::content-type: image/svg+xml
standard::fast-content-type: image/svg+xml
Related: https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/issues/242.
Thank you for the explanation! Something similar might be the cause why file managers attribute different mime types to files of the same type. E.g. xkb files can be determined as C or text/plain.