8000 [Validator] Improve Image constraint invalid mime type message by fancyweb · Pull Request #45090 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Validator] Improve Image constraint invalid mime type message #45090

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

Merged
merged 1 commit into from
Mar 28, 2022

Conversation

fancyweb
Copy link
Contributor
Q A
Branch? 6.1
Bug fix? no
New feature? no
Deprecations? no
Tickets Fix -
License MIT
Doc PR -

Using:

new Image(mimeTypes: ['image/jpeg', 'image/png']);

Uploading a image/gif file, I get:

This file is not a valid image.

The file is actually a valid image but its mime type is not whitelisted. In this case I propose to fall back to the original File constraint message which is better IMO:

The mime type of the file is invalid ("image/gif"). Allowed mime types are "image/jpeg", "image/png".

It gives more hints.

nicolas-grekas added a commit that referenced this pull request Feb 24, 2022
…ints (fancyweb)

This PR was merged into the 4.4 branch.

Discussion
----------

[Validator] Improve tests for the Image and File constraints

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | -
| Tickets       | -
| License       | MIT
| Doc PR        | -

For #45090 but submitting it on the lowest branch possible.

Commits
-------

1a82c71 [Validator] Improve tests for the Image and File constraints
symfony-splitter pushed a commit to symfony/validator that referenced this pull request Feb 24, 2022
…ints (fancyweb)

This PR was merged into the 4.4 branch.

Discussion
----------

[Validator] Improve tests for the Image and File constraints

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | -
| Tickets       | -
| License       | MIT
| Doc PR        | -

For symfony/symfony#45090 but submitting it on the lowest branch possible.

Commits
-------

1a82c716ba [Validator] Improve tests for the Image and File constraints
@fancyweb fancyweb force-pushed the validator/image-mime-types-msg branch from 0e66dbe to ef6be5e Compare February 24, 2022 15:28
@fancyweb fancyweb force-pushed the validator/image-mime-types-msg branch from ef6be5e to b82a145 Compare March 28, 2022 08:43
@fabpot
Copy link
Member
fabpot commented Mar 28, 2022

Thank you @fancyweb.

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
0