Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downloading attachments have wrong filenames (Unicode) #4465

Closed
tomohikosan opened this issue May 24, 2020 · 2 comments · Fixed by #4466
Closed

Downloading attachments have wrong filenames (Unicode) #4465

tomohikosan opened this issue May 24, 2020 · 2 comments · Fixed by #4466
Labels
Projects
Milestone

Comments

@tomohikosan
Copy link

tomohikosan commented May 24, 2020

Describe the bug
Files uploaded with the material editor do not preserve their filenames when downloaded, if they include (non-ASCII) unicode characters.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Material Editor'
  2. Upload file with filename (for example) 'TEST日本語123.txt'
  3. Go to the event page, right-click and download the file above.
  4. The downloaded file has a filename 'TEST123.txt', which is different from the original.

Expected behavior
In the example above, the downloaded filename should be 'TEST日本語123.txt' instead of 'TEST123.txt'.

Screenshots
Here is a screenshot of how the file looks in the agenda page (it is correct here):

unicode-filename

This shows that, at least in this intermediate step, the filename seems to be properly stored.
However, the actual URL to the file (and therefore how the web browser saves the file) does not have the correct filename.

Here is a screenshot of the web browser pointing to the file:

unicode-filename2

Additional context

  • This behavior was seen at http://indico.cern.ch/
  • Uploading seems to be working fine, since the internal representation shows the correct filename.
  • It seems the generation of the download link alters the filename.
  • It seems the non-ASCII characters get omitted.
@ThiefMaster
Copy link
Member

ThiefMaster commented May 24, 2020

We currently strip all non-ascii characters from filenames because back when writing this code a few years ago, browser support for unicode filenames wasn't as good as it is now, so it was the right thing to do.

However, you are right that we should start sending the original filename when downloading a file, and I could have sworn that I created an issue for this a few months ago when implementing this for another case where users can upload files... anyway, now that you created one we have one. :)

@ThiefMaster ThiefMaster added this to the v2.3 milestone May 24, 2020
@ThiefMaster ThiefMaster added this to To do in Release 2.3 via automation May 24, 2020
@tomohikosan
Copy link
Author

tomohikosan commented May 24, 2020

Thank you very much for the quick response!

Release 2.3 automation moved this from To do to Done May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Release 2.3
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants