retitle 574579 glib reports wrong mimetype of svg file with long comments reassign 574579 shared-mime-info 0.71-1 tags 574579 +patch thanks
After some digging, I found out that svg image with long comments at the beginning can not show itself on gtk widgets, is because glib reports the wrong mimetype 'application/xml' instead of 'application/svg+xml', so the pixbufloader can not find the correct svg_loader. here's the testing code I used: ----------------------------------------------------------- #include <gtk/gtk.h> #include <glib/gprintf.h> #include <errno.h> int main(){ FILE *f; guchar buffer [1024]; gboolean uncertain; gchar *mime_type; guint size; const char *filename = "emacs23.svg"; f = g_fopen (filename, "rb"); if ( f == -1) { g_printf("open failed %s \n",g_strerror(errno)); return 1; } size = fread (&buffer, 1, sizeof (buffer), f); if(size == 0){ g_printf("No image data"); } mime_type = g_content_type_guess (NULL, buffer, size, &uncertain); if (uncertain) mime_type = g_content_type_guess (filename, buffer, size, NULL); g_printf("%s \n", mime_type); } ----------------------------------------------------------- here it returns 'application/xml' with uncertain set to false. with an offset of 256 in the svg section of freedesktop.org.xml is too small, I think increasing it to 1024 is reasonable. to update the mime cache we have to run: update-mime-database /usr/share/mime after changing freedesktop.org.xml -------------------------------------------------------------- --- /tmp/freedesktop.org.xml 2010-03-21 14:39:14.730266924 +0800 +++ freedesktop.org.xml 2010-03-21 14:38:40.000000000 +0800 @@ -16246,7 +16246,7 @@ <sub-class-of type="application/xml"/> <magic priority="80"> <match value="<!DOCTYPE svg" type="string" offset="0:256"/> - <match value="<svg" type="string" offset="0:256"/> + <match value="<svg" type="string" offset="0:1024"/> </magic> <glob pattern="*.svg"/> </mime-type> -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org