Skip to content

Conversation

@jackbayliss
Copy link
Contributor

@jackbayliss jackbayliss commented Nov 3, 2025

When using the File rule with custom messages for multiple files in the same request, the wrong message can appear. The generic file message is shown instead of the sub-rule messages (max, size, etc.). - This appears to be introduced by my previous PR - #57356

This PR resolves that and adds a test to prevent regression - I believe only File is affected because it wraps multiple sub-rules and has a default class-based file message. I've tried to same with Password, etc, and have been unable to get it to happen.

The alternative- if this feels too narrow could be:

-        if ($this->getAttributeType($attribute) !== 'file') {
+       if (class_exists($lowerRule) && ! is_subclass_of($lowerRule, DataAwareRule::class)) {

Any suggestions, please let me know 🫡 - Thanks!!

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@jackbayliss jackbayliss marked this pull request as ready for review November 3, 2025 18:37
@taylorotwell taylorotwell merged commit 264ae5b into laravel:12.x Nov 3, 2025
66 checks passed
@jackbayliss jackbayliss deleted the 12.x-file-custom-validation-message branch November 4, 2025 10:59
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.

2 participants