]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1276820 - bmoattachments.org sends malformed content-type header
authorDavid Lawrence <dkl@mozilla.com>
Mon, 27 Jun 2016 20:36:52 +0000 (20:36 +0000)
committerDavid Lawrence <dkl@mozilla.com>
Mon, 27 Jun 2016 20:36:52 +0000 (20:36 +0000)
attachment.cgi

index 104ee0ca8cf8c67ca1afb8a83e3cf86ff2ab6b21..772674bfce70b16b5eecf722e9382d032d47621e 100755 (executable)
@@ -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;