Skip to content

[NYC] Fix brocken file backoffice display#20

Merged
moustachu merged 3 commits intoalt/nycfrom
fix/broken_file_backoffice_display
Jan 29, 2026
Merged

[NYC] Fix brocken file backoffice display#20
moustachu merged 3 commits intoalt/nycfrom
fix/broken_file_backoffice_display

Conversation

@BarbaraOliveira13
Copy link

@BarbaraOliveira13 BarbaraOliveira13 commented Jan 20, 2026

🎩 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

  1. Need to test in production !
  2. Log in as an admin and open any participatory process.
  3. Go to Process → Attachments.
  4. Verify that the “Type” column shows clean MIME types (JPEG, PDF, etc.) instead of S3 URLs with parameters. 🎉

📌 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

  • Add specs
  • Add note about overrides in OVERLOADS.md
  • In case of new dependencies or version bump, update related documentation

📷 Screenshots

525513194-ef3165a6-834a-4b35-a839-e69998f82249 Capture d’écran 2026-01-20 à 10 58 36

Extra information

@BarbaraOliveira13 BarbaraOliveira13 added the ↪️ test decidim-app 0.31 Re-test after going to decidim-app 0.31 label Jan 20, 2026
@BarbaraOliveira13 BarbaraOliveira13 marked this pull request as ready for review January 20, 2026 15:03
@moustachu moustachu merged commit 821f31a into alt/nyc Jan 29, 2026
7 checks passed
@moustachu moustachu deleted the fix/broken_file_backoffice_display branch January 29, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

override: pending ↪️ test decidim-app 0.31 Re-test after going to decidim-app 0.31

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants