Watermarking fails for SVG images #3373
Labels
💻 aspect: code
Concerns the software code in the repository
🛠 goal: fix
Bug fix
🟩 priority: low
Low priority and doesn't need to be rushed
🧱 stack: api
Related to the Django API
🐛 tooling: sentry
Sentry issue
Description
Pillow library that handles watermarking does not support SVG images 1. Watermark returns
424 Failed Dependency
error:"cannot identify image file <_io.BytesIO object at 0x7f213a52cb80>"
Reproduction
Go to an SVG image's watermark endpoint: https://api.openverse.engineering/v1/images/b5f553df-c852-4506-94d4-55b638e4d030/watermark/
See 424 Failed Dependency error:
"cannot identify image file <_io.BytesIO object at 0x7f213a52cb80>"
Sentry error event: https://openverse.sentry.io/issues/4093254538/events/6c4901bc54d3489a985cda2ff0d7578c/
Additional context
In the watermark method, we should check the extension, and return 415 Unsupported media type if it's SVG.
Some fixes to the watermark method were added in #1234
watermark
module is inapi/api/utils/watermark.py
Footnotes
Pillow's supported image formats ↩
The text was updated successfully, but these errors were encountered: