From 557410f34c224543c0afb8686f995fca3297bc68 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Mon, 27 Jun 2016 20:36:52 +0000 Subject: Bug 1276820 - bmoattachments.org sends malformed content-type header --- attachment.cgi | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'attachment.cgi') 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; -- cgit v1.2.3-24-g4f1b