Defect #11568
closed
Uploaded file name gets mangled when it contains a +
Added by Olivier Mehani over 12 years ago.
Updated over 4 years ago.
Description
When uploading a file which names contains a "+", that character gets silently replaced by a space. I suppose this has to do with the parsing of the QUERY_STRING
, but it is annoying there as the + should remain verbatim in the name of the file offered for download through Redmine.
Steps to reproduce:
- Create a file with a '+' in its name (say, "a+b");
- Upload it in the files section of a Redmine project
- The file appears as "a b", and the download link leads to ".../a%20b"
While the file downloads correctly, it is inconvenient to have one's file renamed without control.
Files
a+b (4 Bytes)
a+b |
This file was initially named 'a+b' |
Olivier Mehani, 2012-08-02 06:54
|
|
Right, my experiment shows that I am not up to date. Is this a known bug that has already been addressed? I couldn't find it in the issues.
- Category set to Attachments
- Status changed from New to Confirmed
- Target version set to Candidate for next minor release
Redmine.org is not running the latest version but demo is.
And indeed, it happens with trunk.
Seems to be a Rails issue. The + is already replaced with a space in the original_filename
found in attachment params:
"attachments"=>{"1"=>{"file"=>#<ActionDispatch::Http::UploadedFile:0x4c11fa8 @original_filename="test plus.txt",
@content_type="text/plain", @headers="Content-Disposition: form-data; name=\"attachments[1][file]\";
filename=\"test+plus.txt\"\r\nContent-Type: text/plain\r\n", @tempfile=#<File:xxx/RackMultipart20120814-2236-ogyxbd>>, "description"=>""}}
It works now fine on 2.3.1 and trunk, but confirmed broken on 2.2.4 and 2.1.6.
Relevant log on a fresh install:
redmine-2.2.4/log/development.log: Parameters: [...] "attachments"=>{"1"=>{"file"=>#<ActionDispatch::Http::UploadedFile:0x007fcb8a55e5d0
@original_filename="a b.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"attachments[1][file]\";
filename=\"a+b.txt\"\r\nContent-Type: text/plain\r\n", @tempfile=#<File:/var/folders/2d/ym9f6qbd61x6_xxc51f17wq40000gn/T/
RackMultipart20130505-96276-1v561qz>>, "description"=>""}}, [...]
redmine-2.3.1/log/development.log: Parameters: [...] "attachments"=>{"1"=>{"filename"=>"a+b.txt", "description"=>"",
"token"=>"1.0d599f0ec05c3bda8c3b8a68c32a1b47"}} [...]
The fix is probably related to r10977 ?
Now that it works I think we need to add some tests to ensure it won't break again.
Olivier Mehani wrote:
Steps to reproduce:
- Create a file with a '+' in its name (say, "a+b");
- Upload it in the files section of a Redmine project
- The file appears as "a b", and the download link leads to ".../a%20b"
While the file downloads correctly, it is inconvenient to have one's file renamed without control.
No problem on Redmine 3.0.0.
It seems that we can close this issue.
- Status changed from Confirmed to Closed
- Target version deleted (
Candidate for next minor release)
No problem on Redmine 4.1.
Also available in: Atom
PDF