Ticket #10667 (confirmed Bug)
Uploading non image files results in site error when swallowResizeExceptions is set to False
Reported by: | frisi | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 4.x |
Component: | Archetypes | Version: | 4.1 |
Keywords: | image, pil | Cc: | esteele |
Description
uploading pdfs or other non-image files (customers often do that ;-) to a plone.app.blob.field.ImageField currently results in a site error when trying to edit the content object again.
there is no chance to fix the broken object apart from deleting and re-creating it again. This would happen with ATCTImage too, if swallowResizeExceptions was set to False (defaults to True)
one possibility to fix that for p.a.b.imagefield is to set swallowResizeExceptions = True or use the atct configuration Products.ATContentTypes.configuration.zconf.swallowImageResizeExceptions.enable as Products.ATContentTypes.content.image does it.
maybe the better solution would be to not let people upload other types than those mentioned in 'allowable_content_types'. currently those are set to ('image/gif','image/jpeg','image/png'), however this setting seems not to be used to validate the uploaded file.
Change History
comment:2 Changed 5 years ago by davisagli
- Priority changed from minor to major
- Milestone changed from 4.x to 4.1
i just had to fix this for a custom content type that uses the blob imagefield again after a customer called me that the edit form does no longer work after uploading a pdf to the imagefield.
as using zconf seems not the way to go (#10405) we should simply set swallowResizeExceptions to True in plone.app.blob.field.ImageField. after all getting a site error and beeing not able to upload a working image file at all is definitely not what we want, is it?