-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad exif data prevents image upload #68
Comments
Here is an example JPEG with bad Exif data, taken from a client website: I have no idea what the Exif data says, but the cake on the photo should presumably be black-yellow-black from top to bottom. It currently shows wrong when you follow the direct link. (Link may expire soon as we are doing migration, or it may start showing a correct image. Image may be copyrighted.) |
I run in the following error when i migrate a plone site from 4.3.18 to 5.1.4 via p.a.c migratorview. it sounds like the same issue?
|
Yes, that looks like exactly the same problem. If you need a fix fast, you could try a checkout of |
Branch: refs/heads/4.2.x Date: 2018-11-05T21:10:24+01:00 Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> Commit: plone/plone.namedfile@82c9caf Do not fail image upload when Exif data is bad. plone/plone.namedfile#68 Files changed: M plone/namedfile/file.py Repository: plone.namedfile Branch: refs/heads/4.2.x Date: 2018-11-05T22:08:30+01:00 Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> Commit: plone/plone.namedfile@2f553c5 Forgot to commit news file Files changed: A news/68.bugfix Repository: plone.namedfile Branch: refs/heads/4.2.x Date: 2018-11-09T00:32:47+01:00 Author: Jens W. Klein (jensens) <jk@kleinundpartner.at> Commit: plone/plone.namedfile@d7163c4 Merge pull request #70 from plone/issue-68-branch42 Do not fail image upload when Exif data is bad. [4.2] Files changed: A news/68.bugfix M plone/namedfile/file.py
Branch: refs/heads/master Date: 2018-11-05T21:09:41+01:00 Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> Commit: plone/plone.namedfile@44bd9e5 Do not fail image upload when Exif data is bad. plone/plone.namedfile#68 Files changed: M plone/namedfile/file.py Repository: plone.namedfile Branch: refs/heads/master Date: 2018-11-05T22:06:40+01:00 Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> Commit: plone/plone.namedfile@6a202e9 Forgot to commit news file Files changed: A news/68.bugfix Repository: plone.namedfile Branch: refs/heads/master Date: 2018-11-09T00:34:38+01:00 Author: Jens W. Klein (jensens) <jk@kleinundpartner.at> Commit: plone/plone.namedfile@d29f01e Merge pull request #69 from plone/issue-68-master Do not fail image upload when Exif data is bad. [master] Files changed: A news/68.bugfix M plone/namedfile/file.py
Fixed in 4.2.6 (Plone 5.1) and 5.0.2 (Plone 5.2). |
I have an image with apparently bad Exif data. Uploading this image in Plone 5.1.4 goes wrong. With a pdb in place:
So in line 367,
piexif.dump(exif_data)
throws an exception:plone.namedfile
catches this exception and turns it into a warning.It then tries to fix the Exif data by deleting the
SceneType
key. Apparently that key caused a problem in earlier testing. But that key is not there in my image, so it throws aKeyError
.In fact, only when I delete all keys from
exif_data[‘Exif’]
can I callpiexif.dump(exif_data)
without getting an error.In my particular use case, this is an image that was uploaded without problems to a Plone 4.3 site, and that I am importing with transmogrifier into Plone 5.1. It is not an issue with transmogrifier: simply uploading the image already throws the error.
I would propose that in
NamedBlobImage.__init__
we catch all exceptions thrown byrotate_image
and ignore the Exif data. That is the only place where the function is called.With that change, the full image actually shows up rotated just fine, contrary to how it shows in Plone 4.3. That may depend on the browser. The scales show up fine in both versions.
Note: the Exif handling was added in
plone.namedfile 4.1.1
. The error should be there in Plone 5.1 and 5.2. I will create PRs.The text was updated successfully, but these errors were encountered: