Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watermarking fails for SVG images #3373

Closed
obulat opened this issue Nov 20, 2023 · 0 comments · Fixed by #3460
Closed

Watermarking fails for SVG images #3373

obulat opened this issue Nov 20, 2023 · 0 comments · Fixed by #3460
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

Comments

@obulat
Copy link
Contributor

obulat commented Nov 20, 2023

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 in api/api/utils/watermark.py

Footnotes

  1. Pillow's supported image formats

@obulat obulat added 🟩 priority: low Low priority and doesn't need to be rushed 🛠 goal: fix Bug fix 💻 aspect: code Concerns the software code in the repository 🐛 tooling: sentry Sentry issue 🧱 stack: api Related to the Django API labels Nov 20, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Openverse Backlog Nov 20, 2023
@openverse-bot openverse-bot moved this from 📋 Backlog to 🏗 In Progress in Openverse Backlog Dec 20, 2023
@openverse-bot openverse-bot moved this from 🏗 In Progress to ✅ Done in Openverse Backlog Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant