Bug 329140 - GIF images ending in .jpg cannot be loaded
Summary: GIF images ending in .jpg cannot be loaded
Alias: None
Product: gwenview
Classification: Applications
Component: general (show other bugs)
Version: 4.11.4
Platform: Gentoo Packages Linux
: NOR minor
Target Milestone: ---
Assignee: Gwenview Bugs
URL: http://i.imgur.com/4KUlQ.jpg
Keywords: usability
Depends on:
Reported: 2013-12-22 23:59 UTC by Nicole O'Connor
Modified: 2022-01-29 18:14 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Note You need to log in before you can comment on or make changes to this bug.
Description Nicole O'Connor 2013-12-22 23:59:11 UTC
URL is an example from Imgur.

The following error occurs in the Gwenview UI:
"Loading 'filename' failed:
Loading meta information failed"

Gwenview also sends the following to stdout:
"gwenview(3451) Gwenview::JPEGErrorManager::errorExitCallBack: Not a JPEG file: starts with 0x47 0x49 
gwenview(3451): libjpeg fatal error"

Reproducible: Always

Steps to Reproduce:
1. Rename a GIF file to .jpg
2. Open in Gwenview (local or http doesn't matter)
Actual Results:  
Image fails to load

Expected Results:  
Image displays, perhaps with a warning about file extension/type mismatch

There is a strong case saying it shouldn't be Gwenview's job to compensate for people naming their files incorrectly, and I will also be complaining to Imgur specifically about this. I'm just putting it here too, because even if you choose to mark it as WONTFIX it should still show up in a Google search a few years from now :-)
Comment 1 Christoph Feck 2013-12-23 01:00:46 UTC
Hm, there is actually a commit that should make it work, see 
Comment 2 Greg Lepore 2015-10-27 13:07:37 UTC
This issue is still occurring on Gwenview 15.08.2, KDE Frameworks 5.15.0, Qt 5.4.2.
Comment 3 Nate Graham 2017-11-10 18:26:13 UTC
Greg's right, I can still reproduce using git master.
Comment 4 Bug Janitor Service 2021-04-22 10:58:49 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/gwenview/-/merge_requests/60
Comment 5 Arjen Hiemstra 2021-05-03 11:14:45 UTC
Git commit 6a79391a9ab68bec839897369c665ee2e3afe7e5 by Arjen Hiemstra.
Committed on 29/04/2021 at 09:29.
Pushed by ahiemstra into branch 'master'.

Prefer mime type from content over file name when loading

QMimeDatabase::mimeTypeForFileNameAndData() will prefer using the
filename for mime type determination. This allow it to be fooled when
the filename is something different than the contents. To avoid this,
reverse the logic and first try to determine the mimetype from the
file's contents and only use filename if that fails.

M  +7    -4    lib/document/loadingdocumentimpl.cpp

Comment 6 Nate Graham 2022-01-29 18:14:20 UTC
This fix for this caused Bug 441698, which was a more serious issue, so I have reverted it. Re-opening this.

Hopefully we will find a fix that allows both issues to be fixed so that we don't have to trade one issue for another.