Skip to content

[2.x] feat: all images validated equally#4579

Merged
imorland merged 2 commits intoflarum:2.xfrom
blomstra:dk/4429-introduce-image-validators
Apr 17, 2026
Merged

[2.x] feat: all images validated equally#4579
imorland merged 2 commits intoflarum:2.xfrom
blomstra:dk/4429-introduce-image-validators

Conversation

@luceos
Copy link
Copy Markdown
Contributor

@luceos luceos commented Apr 17, 2026

fixes #4429

The problem

None of the files uploaded through the admin area are validated against "normal" rules. This includes the Logo, favicon and Logo dark variant. As a consequence no proper validation errors are thrown.

The solution

Instead of patching just the Logo controller I refactored the existing AvatarUploader to become an ImageValidator for generic use.

The considerations

The independent validator classes are still required because we have an extender Validator that allows regulating individual validators. As such I could not refactor into one class.

The abstract UploadImageController in the API was refactored to automatically pick up on a specified $validator class automatically and run the validation immediately.

This ought to be backward compatible.

@luceos luceos requested a review from a team as a code owner April 17, 2026 11:30
@luceos luceos changed the title feat: all images validated equally [2.x] feat: all images validated equally Apr 17, 2026
@imorland imorland added this to the 2.0.0-rc.1 milestone Apr 17, 2026
Copy link
Copy Markdown
Member

@imorland imorland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, thank you @luceos

@imorland imorland merged commit 6a4831a into flarum:2.x Apr 17, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2.x] Improve error messaging for unsupported file types in "appearance"

2 participants