Skip to content

Commit

Permalink
Fixes validation failures of avatars that are jpg/jpeg (#2497)
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
luceos authored Dec 16, 2020
1 parent fd5de69 commit 06e1d21
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"symfony/config": "^4.3.4",
"symfony/console": "^4.3.4",
"symfony/event-dispatcher": "^4.3.4",
"symfony/mime": "^5.2.0",
"symfony/translation": "^4.3.4",
"symfony/yaml": "^4.3.4",
"tobscure/json-api": "^0.3.0",
Expand Down
2 changes: 1 addition & 1 deletion src/User/AvatarValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ protected function getMaxSize()

protected function getAllowedTypes()
{
return ['jpeg', 'png', 'bmp', 'gif'];
return ['jpg', 'png', 'bmp', 'gif'];
}
}

0 comments on commit 06e1d21

Please sign in to comment.