GNOME Bugzilla – Bug 618757
EOG fails to load images with the wrong extension, but loads them if they have an unknown extension
Last modified: 2010-05-16 08:14:17 UTC
Created attachment 161156 [details] Test file. Download the attached file and name it with an unknown extension, for example: "image.gnome". EOG will load it without a hitch. Now rename the same file to "image.png" or "image.gif" and try to load it. EOG will complain that the file doesn't seem to be a $file_type. IMVHO EOG should try a bit harder to load the image if the extension is wrong. This blocks Epiphany's bug 302986.
Ok, I've traced this down to: g_content_type_guess() [in gio/gcontenttype.c] which is called by get_content_type() [in gio/glocalfileinfo.c] Called by gio for the local file, when we request info in: eog_image_get_file_info() [in src/eog-image.c]: if (mime_type) *mime_type = g_strdup (g_file_info_get_content_type (file_info)); We use mime_type to construct a typed pixbuf loader: eog_image_real_load() [in src/eog-image.c]: loader = gdk_pixbuf_loader_new_with_mime_type (mime_type, error); -- There seems to be something wrong with mime sniffing via gio (xdgmime). Why do you use a typed pixbuf loader anyway? The mime type is gonna be consulted anyway so you are not saving much performance or security (considering that glib [xdgmime] could probably be fooled as much as gdk). This works fine if I use the general pixbuf loader instead of the typed one. Would you accept a patch for this?
Btw, on some rhough testing it seems there's no noticeable difference in performance. I tried to make a 700 mb file pass as a gif and no noticeable slowness while 'sniffing' was felt in current or modified code.
*** This bug has been marked as a duplicate of bug 490067 ***