-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
Asserting validaton rule image fails on image/avif mime type. #49755
Comments
Here is the related code: framework/src/Illuminate/Validation/Concerns/ValidatesAttributes.php Lines 1313 to 1316 in 443ec44
You may use |
@hafezdivandari Thanks for the reply and pointing it out, I'm happy to make the PR. If possible for the Laravel developers/maintainers, I'd like to open the discussion and inquire why we're using specifically designated MIMEs rather than asserting the condition on the family. It seems like it would make more sense to handle things that way. |
Thank you for reporting this issue! As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub. If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team. Thank you! |
@Elycin You mean something like this? - return $this->validateMimes($attribute, $value, ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg', 'webp']);
+ return $this->validateMimetypes($attribute, $value, 'image/*'); You should target
Maybe to only accept image file types that are generally supported by web browsers: https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types Then we can just add |
Right now this type isn't part of the image rule. There's no specific reason. You could attempt a PR to add if if you like. |
Laravel Version
10.21.1
PHP Version
8.3.2
Database Driver & Version
MariaDB 10.6
Description
When attempting to upload an image that uses the 'image' validation rule, with a .AVIF filetype, you will encounter a validation error that returns 422 Unprocessable Entity.
Header dump from Google Chrome
Transplied Curl Request:
Telescope Payload:
Rules method of Reqeust:
Telescope Response
Steps To Reproduce
The text was updated successfully, but these errors were encountered: