Ticket #10667 (confirmed Bug)

Opened 6 years ago

Last modified 3 years ago

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:1 Changed 6 years ago by frisi

  • Milestone changed from 3.3.x to 4.x

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?

comment:2 Changed 5 years ago by davisagli

  • Priority changed from minor to major
  • Milestone changed from 4.x to 4.1

comment:3 Changed 4 years ago by eleddy

  • Status changed from new to confirmed
  • Keywords pil added; pil, removed
  • Version set to 4.1
  • Cc esteele added

also see #12790 for alternative solutions

comment:4 Changed 3 years ago by petschki

there's another ticket which is quite similar #11608

Note: See TracTickets for help on using tickets.