Bug 27318

Summary: SVG with long comments not recognized as such
Product: shared-mime-info Reporter: Josselin Mouette <joss>
Component: freedesktop.org.xmlAssignee: Shared Mime Info group <shared_mime_info>
Status: RESOLVED NOTOURBUG QA Contact:
Severity: minor    
Priority: medium CC: chandniverma2112
Version: unspecified   
Hardware: All   
OS: All   
URL: http://bugs.debian.org/574579
Whiteboard:
i915 platform: i915 features:
Attachments: Search for the <svg> tag up to 1024 characters

Description Josselin Mouette 2010-03-25 12:26:13 UTC
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.
Comment 1 Bastien Nocera 2010-06-16 06:06:51 UTC
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.
Comment 2 Bastien Nocera 2012-08-18 17:47:42 UTC
*** Bug 48264 has been marked as a duplicate of this bug. ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.