After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 618757 - EOG fails to load images with the wrong extension, but loads them if they have an unknown extension
EOG fails to load images with the wrong extension, but loads them if they hav...
Status: RESOLVED DUPLICATE of bug 490067
Product: eog
Classification: Core
Component: image viewer
git master
Other Linux
: Normal normal
: ---
Assigned To: EOG Maintainers
EOG Maintainers
Depends on:
Blocks: 302986
 
 
Reported: 2010-05-16 01:56 UTC by Diego Escalante Urrelo (not reading bugmail)
Modified: 2010-05-16 08:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test file. (2.74 KB, image/jpeg)
2010-05-16 01:56 UTC, Diego Escalante Urrelo (not reading bugmail)
Details

Description Diego Escalante Urrelo (not reading bugmail) 2010-05-16 01:56:28 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.
Comment 1 Diego Escalante Urrelo (not reading bugmail) 2010-05-16 03:28:09 UTC
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?
Comment 2 Diego Escalante Urrelo (not reading bugmail) 2010-05-16 03:50:03 UTC
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.
Comment 3 Claudio Saavedra 2010-05-16 08:14:17 UTC

*** This bug has been marked as a duplicate of bug 490067 ***