]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 328628: When attachments have UTF-8 characters in their name, they will now be...
authormkanat%bugzilla.org <>
Wed, 30 Sep 2009 08:53:25 +0000 (08:53 +0000)
committermkanat%bugzilla.org <>
Wed, 30 Sep 2009 08:53:25 +0000 (08:53 +0000)
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=Wurblzap, a=mkanat

attachment.cgi

index 89ef45152571142cbb4fded645b477ad1e03d4d7..da705a5cdd85d567501b644372c8c182b5631174 100755 (executable)
@@ -52,6 +52,8 @@ use Bugzilla::Attachment::PatchReader;
 use Bugzilla::Token;
 use Bugzilla::Keyword;
 
+use Encode qw(encode);
+
 # For most scripts we don't make $cgi and $template global variables. But
 # when preparing Bugzilla for mod_perl, this script used these
 # variables in so many subroutines that it was easier to just
@@ -336,6 +338,11 @@ sub view {
     $filename =~ s/\\/\\\\/g; # escape backslashes
     $filename =~ s/"/\\"/g; # escape quotes
 
+    # Avoid line wrapping done by Encode, which we don't need for HTTP
+    # headers. See discussion in bug 328628 for details.
+    local $Encode::Encoding{'MIME-Q'}->{'bpl'} = 10000;
+    $filename = encode('MIME-Q', $filename);
+
     my $disposition = Bugzilla->params->{'allow_attachment_display'} ? 'inline' : 'attachment';
 
     print $cgi->header(-type=>"$contenttype; name=\"$filename\"",