code4romania / onghub

Mozilla Public License 2.0
7 stars 5 forks source link

[NGO Registration] The statute loses its extension #473

Open tudoramariei opened 6 months ago

tudoramariei commented 6 months ago

Describe the bug

The statute of the organization uploaded in the app loses its extension.

Steps to reproduce the behavior

  1. Register an organization and add a statute
  2. Go to /organization/legal and download the file
  3. The file is downloaded without any extension

Expected behavior

The file's extension should be kept, especially if someone manages to upload something that isn't a PDF.

Additional context

We saw that some NGOs managed to upload a non-PDF file as a statute (an organization managed to upload a TXT file a few days ago). While we weren't able to reproduce the issue, not knowing what kind of file this is could cause big problem for our workflow.

mirunaioana-msc commented 4 months ago

In production, we cannot reproduce this behaviour (uploading a document that is not .pdf). However, it is relevant to display in the organization's profile the extension of the uploaded file (eg: Statut.pdf, instead of Statut)

dragos1195 commented 2 months ago

I've added a fix to this in PR https://github.com/code4romania/onghub/pull/592

We're going to download correctly (with extension) newly added files

However, we will not display the correct extension in the front end, as it is not saved anywhere in the DB. We generate pre signed URLs from AWS to access the files, but we do not have the extension files.

It should be correctly handled when developing a document list for each organization.

@mirunaioana-msc @tudoramariei