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

fix: fix handling of corrupted images #205

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

fix: fix handling of corrupted images #205

wants to merge 2 commits into from

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Jan 30, 2024

🧿 Current issues / What's wrong ?

Although rare, image processing fail on some corrupted, or badly generated image, making the while workflow crash with a unhandled error.

💊 Fixes / Solution

Fix #152
Fix PINEAPPLE-7

Some devices such as older samsung galaxy are generating "corrupted" images (see lovell/sharp#1578)

By ignoring corruption error, those image can be processed.

In case user upload a genuine corrupted image, it will just output a corrupted image, and will be the user fault.

🚧 Changes

  • Refactor to extract the image processing inside utils.ts, for easier testing
  • Add tests for the image processing
  • Allow corrupted image to be processed

🛠️ Tests

An example of corrupted image is in test/units/providers/fixtures/corrupted.jpeg

Try uploading to pineapple:

before: it fails with an VipsJpeg: Invalid SOS parameters for sequential JPEG error
after: it should work

@wa0x6e wa0x6e requested a review from ChaituVR January 30, 2024 11:48
Copy link

codecov bot commented Jan 30, 2024

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Files Patch % Lines
src/upload.ts 0.00% 11 Missing ⚠️
Additional details and impacted files

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error: VipsJpeg: Invalid SOS parameters for sequential JPEG
1 participant