AO3-7473 Possible to upload unusable collection/skin icon#5825
Open
cinderbrick1212 wants to merge 2 commits into
Open
AO3-7473 Possible to upload unusable collection/skin icon#5825cinderbrick1212 wants to merge 2 commits into
cinderbrick1212 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR prevents 500 errors during Skin/Collection icon processing by restricting icon uploads to raster image MIME types that the resizing pipeline can safely handle (GIF/JPEG/PNG), matching the existing Pseud icon validation approach.
Changes:
- Tightened
Skiniconallowed_formatsfrom anyimage/*MIME type toimage/gif,image/jpeg, andimage/png. - Tightened
Collectioniconallowed_formatsfrom anyimage/*MIME type toimage/gif,image/jpeg, andimage/png.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| app/models/skin.rb | Restricts Skin icon MIME types to GIF/JPEG/PNG to avoid unsupported formats causing processing errors. |
| app/models/collection.rb | Restricts Collection icon MIME types to GIF/JPEG/PNG to avoid unsupported formats causing processing errors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
57
to
60
| validates :icon, attachment: { | ||
| allowed_formats: %r{image/\S+}, | ||
| allowed_formats: %w[image/gif image/jpeg image/png], | ||
| maximum_size: ArchiveConfig.ICON_SIZE_KB_MAX.kilobytes | ||
| } |
Comment on lines
12
to
15
| validates :icon, attachment: { | ||
| allowed_formats: %r{image/\S+}, | ||
| allowed_formats: %w[image/gif image/jpeg image/png], | ||
| maximum_size: ArchiveConfig.ICON_SIZE_KB_MAX.kilobytes | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
as the first thing in your pull request title (e.g.
AO3-7473 Fix 500 error on Skin and Collection icon uploads)until they are reviewed and merged before creating new pull requests.
Issue
https://otwarchive.atlassian.net/browse/AO3-7473
Purpose
I updated the allowed image formats for Skin and Collection icons to prevent 500 errors.
Previously, the validation accepted any
image/*MIME type, which caused server crashes when the image processing library attempted to resize unsupported vector formats like SVGs. I updatedapp/models/skin.rbandapp/models/collection.rbto strictly allowimage/gif,image/jpeg, andimage/png, mirroring the safer validation that is already in place forPseudicons.Testing Instructions
.svgfile (or another unsupported image format) as the icon and submit the form..png,.jpg, or.gifto ensure standard uploads still process correctly for both models.Credit
Anish Kapoor (he/him)