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

Handle mislabeled image files better #735

Open
waisaed opened this issue Feb 6, 2025 · 0 comments
Open

Handle mislabeled image files better #735

waisaed opened this issue Feb 6, 2025 · 0 comments

Comments

@waisaed
Copy link
Member

waisaed commented Feb 6, 2025

Issue:

Changes to Figure 7 of this case cannot be saved:

Image

irb(main):016:0> pp e.errors.full_messages
["Image must be JPEG or PNG"]
=> ["Image must be JPEG or PNG"]

Image is likely a .tiff that somehow passed imagine/tiff validates method:

 message: 'cannot be larger than 2 MB' },
                    content_type: { in: %w[image/png image/jpeg],
                                    message: 'must be JPEG or PNG' }

Expected behavior:

  • JPEG or PNG images can be uploaded
  • other images are screened out by validation, even if mislabeled, so this state is avoided

Solution criteria:

  • We can allow a wider range of formats. Uncompressed formats are non-ideal, but we already restrict image size to 2mb.
  • We should safely screen out files that don't match their extension
@waisaed waisaed added bug and removed bug labels Feb 6, 2025
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

No branches or pull requests

1 participant