Image serialization with SVG format fails
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 109
- Forks
- 107
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 4
Description
plone.namedimage supports SVG images, but when we are serializing them, we are not checking if it's an SVG, then we attempt to calculate the scales anyway, unconditionally:
https://github.com/plone/plone.restapi/blob/master/src/plone/restapi/serializer/dxfields.py#L46
We have to detect if there's an SVG inside and decide what to show in the scales property, since applications can expect to have both SVG and normal images. I would place the SVG download in all the expected scales.
As a weird side effect, this leads to a write in the database (WTF?!) then we get a transaction abort (due to CRSF protection) error.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at src/plone/restapi/serializer/dxfields.py around line 46 and reproduce serialization of an SVG image. Compare the scales representation with normal images, then verify that SVG serialization provides the expected scale entries without triggering the reported database write or transaction-abort side effect.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100