#58 — getSize usage in Products.CMFEditions.StandardHandlers can break with BlobFiles
by
Patrick Gerken
—
last modified
Mar 17, 2010 12:25 PM
| State | Unconfirmed |
|---|---|
| Version: |
—
|
| Area | Functionality |
| Issue type | Bug |
| Severity | Medium |
| Submitted by | Patrick Gerken |
| Submitted on | Feb 10, 2010 |
| Responsible |
—
|
| Target release: |
—
|
I can not reproduce the exact behaviour on a test system as we are seeing in on production, but the behavior is faulty.
CMFEditions uses getSize in the StandardHandlers to check if an object is too big for something. But getSize is meant to return a tuple of image information for archetypes image fields.
plone.app.blob uses a Wrapper for both images and files, the wrapper implements getSize for files too, and assumes that you won't call getSize for non Image files.
If you do, it lets PIL get the image size of its file object. That fails for non image files and will throw various kinds of exceptions.
I am patching plone.app.blob right now to catch these exceptions and wrap them in an AttributeError, so that CMFEditions can handle that exception.
I will create a branch of CMFEditions for this reason too.
CMFEditions uses getSize in the StandardHandlers to check if an object is too big for something. But getSize is meant to return a tuple of image information for archetypes image fields.
plone.app.blob uses a Wrapper for both images and files, the wrapper implements getSize for files too, and assumes that you won't call getSize for non Image files.
If you do, it lets PIL get the image size of its file object. That fails for non image files and will throw various kinds of exceptions.
I am patching plone.app.blob right now to catch these exceptions and wrap them in an AttributeError, so that CMFEditions can handle that exception.
I will create a branch of CMFEditions for this reason too.
Added by
Patrick Gerken
on
Feb 12, 2010 02:32 PM
While getSize still might be the wrong method to calculate the object size, the problem above is actually theoretical.Further debugging revealed that either python or the vmware has an issue, since the exception thrown cannot be thrown in that circumstance, and the exception that should get thrown and gets thrown on other computers gets properly handled by both PIL and plone.app.blob, with pa.blob returning None instead of passing the Exception.
A returned None gets handled correctly.
So this bug can be rejected or closed.
Added by
Andreas Zeidler
on
Mar 17, 2010 12:25 PM
well, actually `getSize` shouldn't be supported for non-image content — could you please try to fix in http://dev.plone.org/plone/changeset/35091?
No responses can be added.
If you can, please log in before submitting a reaction.
