Project

General

Profile

Actions

Defect #11568

closed

Uploaded file name gets mangled when it contains a +

Added by Olivier Mehani over 12 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Attachments
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

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:
  1. Create a file with a '+' in its name (say, "a+b");
  2. Upload it in the files section of a Redmine project
  3. 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
Actions #1

Updated by Olivier Mehani over 12 years ago

Actions #2

Updated by Olivier Mehani over 12 years ago

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.

Actions #3

Updated by Etienne Massip over 12 years ago

  • 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.

Actions #4

Updated by Jean-Philippe Lang over 12 years ago

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"=>""}}
Actions #5

Updated by Jean-Baptiste Barth over 11 years ago

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.

Actions #6

Updated by Go MAEDA almost 10 years ago

Olivier Mehani wrote:

Steps to reproduce:
  1. Create a file with a '+' in its name (say, "a+b");
  2. Upload it in the files section of a Redmine project
  3. 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.

Actions #7

Updated by Toshi MARUYAMA almost 5 years ago

  • Status changed from Confirmed to Closed
  • Target version deleted (Candidate for next minor release)

No problem on Redmine 4.1.

Actions

Also available in: Atom PDF