Bug 297656 - Opening a file which extension has been changed to another format extension causes Krita to exit
Summary: Opening a file which extension has been changed to another format extension c...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Usability (show other bugs)
Version: 2.4-snapshots
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-07 14:01 UTC by Antoine
Modified: 2012-04-15 12:56 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine 2012-04-07 14:01:29 UTC
Rename a .png file to .jpg.
Open it with Krita.
Krita exits with: Not a JPEG file: starts with 0x89 0x50

Krita should check first if the content matches the extension.
Comment 1 Halla Rempt 2012-04-08 14:45:33 UTC
specific to the jpg filter. Other filters refuse to load but don't quit Krita.
Comment 2 Halla Rempt 2012-04-08 15:02:15 UTC
We could probably fix this really nicely at the calligra level...
Comment 3 Halla Rempt 2012-04-09 11:24:21 UTC
See https://git.reviewboard.kde.org/r/104520/ -- not as nice as I had hoped, but there's hope yet :-)
Comment 4 Halla Rempt 2012-04-15 12:55:54 UTC
Git commit f13ecfb4e5ae5d0491f7c9ae2ab8935c9adda0c4 by Boudewijn Rempt.
Committed on 15/04/2012 at 14:55.
Pushed by rempt into branch 'master'.

Use the content magick for determining the mimetype of local image files

KMimeType just checks the extension, to "give the user flexibility".
This means that if the user has used that flexibility to rename a JPG
file to bla.png, Krita gets confused because it thinks it's loading a PNG.

For images, the magick is actually much more reliable than the extension,
so use that.

M  +36   -3    libs/main/KoDocument.cpp
M  +1    -0    libs/main/KoDocument.h

http://commits.kde.org/calligra/f13ecfb4e5ae5d0491f7c9ae2ab8935c9adda0c4
Comment 5 Halla Rempt 2012-04-15 12:56:30 UTC
Git commit 35a9d67c28c647071a335ff976001ce02620f882 by Boudewijn Rempt.
Committed on 15/04/2012 at 14:55.
Pushed by rempt into branch 'calligra/2.4'.

Use the content magick for determining the mimetype of local image files

KMimeType just checks the extension, to "give the user flexibility".
This means that if the user has used that flexibility to rename a JPG
file to bla.png, Krita gets confused because it thinks it's loading a PNG.

For images, the magick is actually much more reliable than the extension,
so use that.

M  +36   -3    libs/main/KoDocument.cpp
M  +1    -0    libs/main/KoDocument.h

http://commits.kde.org/calligra/35a9d67c28c647071a335ff976001ce02620f882