Defect #27076
closedCannot open attachements with special characters in filename
0%
Description
When an attachment is added to a new entry with a special character in the filename, it is not possible to open the attachment after saving (404 - document not found).
After some investigating I found that the attachment in the database uses two columns to determine the matching between displayname and actual file on disk - 'filename' and 'disk_filename'.
An attachment with a special character in the filename (eg. täst.txt) is saved in the database like that: 'filename' => 'täst.txt', 'disk_filename' => '170926091327_3de45324.....txt'.
In redmine, the attachment name is shown as täst.txt but the underlying href link points to t%C3%C4st.txt and on open leads - as mentioned before - to an error 404.
Now, when I update the corresponding database entry to 'filename' => 't%C3%C4st.txt' the link then works. Unfortunately redmine then displays the name as 't%C3%A4st.txt'.
Related issues
Updated by Toshi MARUYAMA about 7 years ago
- Status changed from New to Needs feedback
Please see submissions.
Updated by Markus Schenk about 7 years ago
Hi Toshi,
Sorry about that; here's the missing information
I have upgraded from 3.2.5 to 3.4.2. Database is up to date (bundle exec rake db:migrate RAILS_ENV=production).
Postgres Version is 9.1.
ruby bin/about:
sh: svn: command not found
sh: darcs: command not found
sh: hg: command not found
sh: cvs: command not found
sh: bzr: command not found
sh: git: command not found
Environment:
Redmine version 3.4.2.stable
Ruby version 2.4.1-p111 (2017-03-22) [x86_64-linux]
Rails version 4.2.9
Environment production
Database adapter PostgreSQL
SCM:
Filesystem
Redmine plugins:
no plugin installed
snippet from access log
"POST /redmine/uploads.js?attachment_id=1&filename=t%C3%A4st.txt&content_type=text%2Fplain HTTP/1.1" 200
"GET /redmine/attachments/23484/t%C3%A4st.txt HTTP/1.1" 404
then after my update to the database entry
"GET /redmine/attachments/23484/t%25C3%25A4st.txt HTTP/1.1" 200
Best regards
Markus
Updated by Toshi MARUYAMA about 7 years ago
- Status changed from Needs feedback to Closed
- Resolution set to Duplicate
Duplicate of #26337.
Why do you use Rails 4.2.9?
Updated by Toshi MARUYAMA about 7 years ago
- Is duplicate of Defect #26337: Can't download attachments with russian letters in name (from issue) added
Updated by Markus Schenk about 7 years ago
Toshi MARUYAMA wrote:
Duplicate of #26337.
Why do you use Rails 4.2.9?
Well, before updating I checked the redmine install wiki page for a recommended version. The recommended version is 4.2 so I used the most current 4.2. release.
Thank you for the fast response. I will downgrade my rails version.
Updated by Toshi MARUYAMA about 7 years ago
Redmine uses pinned Rails version in order to prevent behaviour change link this issue.
source:tags/3.4.2/Gemfile#L7
How do you use Rails 4.2.9?