Bug 27318 - SVG with long comments not recognized as such
Summary: SVG with long comments not recognized as such
Alias: None
Product: shared-mime-info
Classification: Unclassified
Component: freedesktop.org.xml (show other bugs)
Version: unspecified
Hardware: All All
: medium minor
Assignee: Shared Mime Info group
QA Contact:
URL: http://bugs.debian.org/574579
: 48264 (view as bug list)
Depends on:
Reported: 2010-03-25 12:26 UTC by Josselin Mouette
Modified: 2012-08-18 17:47 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

Search for the <svg> tag up to 1024 characters (476 bytes, patch)
2010-03-25 12:26 UTC, Josselin Mouette
Details | Splinter Review

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.