From: David Lawrence Date: Mon, 27 Jun 2016 20:36:52 +0000 (+0000) Subject: Bug 1276820 - bmoattachments.org sends malformed content-type header X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=557410f34c224543c0afb8686f995fca3297bc68;p=thirdparty%2Fbugzilla.git Bug 1276820 - bmoattachments.org sends malformed content-type header --- 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;