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

[6.x] Fix validating image/jpeg images after Symfony/Mime update #35419

Merged
merged 2 commits into from
Nov 30, 2020
Merged

[6.x] Fix validating image/jpeg images after Symfony/Mime update #35419

merged 2 commits into from
Nov 30, 2020

Conversation

Grldk
Copy link
Contributor

@Grldk Grldk commented Nov 30, 2020

Symfony/Mime v5.20 changed the returned extension for an image with image/jpeg mime type: symfony/mime@aa1d922

This breaks laravel image validation, as it relied on a return value of .jpeg. This commit adds .jpg, which fixes the validation.

(see #35416)

Symfony/Mime v5.20 changed the returned extension for an image with image/jpeg mime type: symfony/mime@aa1d922. This commit adds `.jpg`, which fixes the validation.
@GrahamCampbell
Copy link
Member

Note to reviewers: Laravel 6 requires Symfony 4 components, but those in turn allow both Symfony 4 and 5 for their own dependencies. The mime dependency is one of those, which is why this really does need patching on 6.x.

@patrickomeara
Copy link
Contributor

Just a follow up note to this.

Previously mimes:jpeg would accept jpg and jpeg, but now won't accept either. mimes:jpg must be used to accept both.

The breaking change is in https://github.com/symfony/symfony/pull/38407/files#diff-d9bc28406dbb260810697db93dd597ace181aa0a6b60fc920c3ab5da92203c1eL1323

Swapping the values back to what they were before the change ie. 'image/jpeg' => ['jpeg', 'jpg', 'jpe'], brings back the previous functionality.

I believe Laravel should accept both jpg and jpeg if either are mentioned in the mimes:

At the moment the example snippet in the docs won't accept either jpeg or jpg. https://laravel.com/docs/master/validation#basic-usage-of-mime-rule

@driesvints
Copy link
Member

Thanks @patrickomeara. I've sent in a PR to the docs to fix that as well as a PR to reintroduce the previous behavior for the mimes rule: #35518

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.

6 participants