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

Fixes validation failures of avatars that are jpg/jpeg #2497

Merged
merged 1 commit into from
Dec 16, 2020

Conversation

luceos
Copy link
Member

@luceos luceos commented Dec 15, 2020

Summary: https://discuss.flarum.org/d/25536-avatar-upload-jpg/47

Due to a commit by @fabpot in october, the mimetypes symfony class
now re-orders the shortened mimetypes that are returned when looking
up based on header mimetype. Our validator uses the first key, pops
the prefix off and then matches against our hardcoded array.

I've added a constraint to symfony/mime ^5.2.0 which ships with this change.
This constraint is fully compatible with our current lineup. In addition
I changed the hardcoded array to use the first entry from symfony mime types
now jpg instead of jpeg.

This change has been locally tested and confirmed fixed.

Due to a commit by @fabpot in october, the mimetypes symfony class
now re-orders the shortened mimetypes that are returned when looking
up based on header mimetype. Our validator uses the first key, pops
the prefix off and then matches against our hardcoded array.

I've added a constraint to symfony/mime ^5.2.0 which ships with this change.
This constraint is fully compatible with our current lineup. In addition
I changed the hardcoded array to use the first entry from symfony mime types
now `jpg` instead of `jpeg`.

This change has been locally tested and confirmed fixed.
Copy link
Member

@clarkwinkelmann clarkwinkelmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not tested, but looking good 👍

@askvortsov1
Copy link
Sponsor Member

Should we remove jpeg entirely? I'm not that familiar with how this system works, but why not have both?

@askvortsov1 askvortsov1 merged commit 06e1d21 into master Dec 16, 2020
@askvortsov1 askvortsov1 deleted the dk/fix-avatar-upload-jpg branch December 16, 2020 18:53
SychO9 pushed a commit to SychO9/flarum-profile-cover that referenced this pull request Dec 23, 2020
An update of symfony/mime renders the current validator incompatible. This issue is identical to the one from flarum/core's avatar uploader (flarum/framework#2497) and can be fixed in the same way. Tested locally
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants