Bug 232993: Quote the filenames in the Content-disposition header when…

Bug 232993: Quote the filenames in the Content-disposition header when downloading attachments. This allows spaces to be used in filenames, and fixes compliance with RFCs 2183, 2045, and 822. r= myk, a= justdave
parent 545a42a0
......@@ -480,8 +480,12 @@ sub view
$filename =~ s/^.*[\/\\]//;
my $filesize = length($thedata);
# escape quotes and backslashes in the filename, per RFCs 2045/822
$filename =~ s/\\/\\\\/g; # escape backslashes
$filename =~ s/"/\\"/g; # escape quotes
print Bugzilla->cgi->header(-type=>"$contenttype; name=\"$filename\"",
-content_disposition=> "inline; filename=$filename",
-content_disposition=> "inline; filename=\"$filename\"",
-content_length => $filesize);
print $thedata;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment