Skip to content

[6.x] Handle validation rules on Files fieldtype#14262

Merged
jasonvarga merged 1 commit into6.xfrom
files-fieldtype-validation
Mar 16, 2026
Merged

[6.x] Handle validation rules on Files fieldtype#14262
jasonvarga merged 1 commit into6.xfrom
files-fieldtype-validation

Conversation

@duncanmcclean
Copy link
Member

This pull request fixes an issue where the Files fieldtype would throw a 500 error when using min_filesize or max_filesize validation rules.

This was happening because the Files fieldtype doesn't have a fieldRules() method to map these custom validation rules to their corresponding Rule classes. When rules like max_filesize:10240 were passed to Laravel's validator, it tried to find a validateMaxFilesize method which doesn't exist.

This PR fixes it by defending a fieldRules() method on the Files fieldtype, just like we do on the Assets fieldtype.

Fixes #14083

@jasonvarga jasonvarga merged commit 27ef681 into 6.x Mar 16, 2026
18 checks passed
@jasonvarga jasonvarga deleted the files-fieldtype-validation branch March 16, 2026 18:25
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.

Files field: Filesize validation rules give 500 error

2 participants