Created attachment 34444 [details] [review]
Search for the <svg> tag up to 1024 characters
Some SVG files have a very long comment at the beginning, including a license boilerplate, before the <svg> tag.
Since the pattern match for SVG is limited to 256 characters, they are not recognized as such by e.g. GdkPixbuf.
We won't be increasing the offset to look for "<svg>". We have a maximum of 256 used to avoid excessive I/O.
The file would already be detected as SVG through its suffix.
The problems I can see lie in the GNOME stack:
- _gdk_pixbuf_get_module in gtk+/gdk-pixbuf/gdk-pixbuf-io.c should fall-back on using format_check() if it cannot get a useful magic from xdg-mime (in the GDK_PIXBUF_USE_GIO_MIME case).
- nautilus should probably trust filename guessing for content-types, or simply use gdk-pixbuf if unsure about the mime-type of a file based on magic.
In your case, you could work around the problem by moving the comments to the bottom of the file.
*** Bug 48264 has been marked as a duplicate of this bug. ***