Bug 297656

Summary: Opening a file which extension has been changed to another format extension causes Krita to exit
Product: [Applications] krita Reporter: Antoine <alecail>
Component: UsabilityAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: halla
Priority: NOR    
Version: 2.4-snapshots   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

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