summaryrefslogtreecommitdiffstats
path: root/attachment.cgi
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2016-06-27 22:36:52 +0200
committerDavid Lawrence <dkl@mozilla.com>2016-06-27 22:36:52 +0200
commit557410f34c224543c0afb8686f995fca3297bc68 (patch)
treeeaea2fd12353fd111623e3e4603d2e25f379b7c0 /attachment.cgi
parentacba90e8e41c4ecdf40f32a5820b4ea7ef3db458 (diff)
downloadbugzilla-557410f34c224543c0afb8686f995fca3297bc68.tar.gz
bugzilla-557410f34c224543c0afb8686f995fca3297bc68.tar.xz
Bug 1276820 - bmoattachments.org sends malformed content-type header
Diffstat (limited to 'attachment.cgi')
-rwxr-xr-xattachment.cgi9
1 files changed, 6 insertions, 3 deletions
diff --git a/attachment.cgi b/attachment.cgi
index 104ee0ca8..772674bfc 100755
--- a/attachment.cgi
+++ b/attachment.cgi
@@ -427,7 +427,7 @@ sub view {
if ($contenttype !~ /\bcharset=/i) {
# In order to prevent Apache from adding a charset, we have to send a
# charset that's a single space.
- $cgi->charset(' ');
+ $cgi->charset("''");
if (Bugzilla->feature('detect_charset') && $contenttype =~ /^text\//) {
my $encoding = detect_encoding($attachment->data);
if ($encoding) {
@@ -437,8 +437,11 @@ sub view {
}
Bugzilla->log_user_request($attachment->bug_id, $attachment->id, "attachment-get")
if Bugzilla->user->id;
- print $cgi->header(-type=>"$contenttype; name=\"$filename\"",
- -content_disposition=> "$disposition; filename=\"$filename\"",
+ # IE8 and older do not support RFC 6266. So for these old browsers
+ # we still pass the old 'filename' attribute. Modern browsers will
+ # automatically pick the new 'filename*' attribute.
+ print $cgi->header(-type=> $contenttype,
+ -content_disposition=> "$disposition; filename=\"$filename\"; filename*=UTF-8''$filename",
-content_length => $attachment->datasize);
disable_utf8();
print $attachment->data;