[NYC] Fix brocken file backoffice display#20
Merged
Conversation
moustachu
approved these changes
Jan 29, 2026
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.
🎩 Description
In the NYC plateform, the “Type” column in the attachments table displayed full AWS S3 URLs with query parameters (e.g. response-content-type=image%2fjpeg...) instead of the actual MIME type (JPEG, PDF, etc.).
Solution (instead of passing by AWS who will work after passing on decidim_app):
Patched the Decidim::Attachment model to redefine the file_type method.
The method now reads the MIME type directly from ActiveStorage::Blob#content_type instead of parsing the file URL.
Updated application.rb to ensure manual loading of decorators after initialization.
Result:
File types in the admin attachments table now display clean values (JPEG, PDF, etc.) even for long, signed AWS URLs.
Testing
📌 Related Issues
Link your PR to an issue
https://github.com/orgs/OpenSourcePolitics/projects/26/views/1?filterQuery=nyc&pane=issue&itemId=144569396&issue=OpenSourcePolitics%7Cintern-tasks%7C292&visibleFields=%5B%22Title%22%2C%22Assignees%22%2C%22Status%22%2C72184574%2C%22Linked+pull+requests%22%2C%22Labels%22%2C%22Repository%22%5D
OpenSourcePolitics/intern-tasks/issues/292
Tasks
📷 Screenshots
Extra information