diff options
author | mkanat%bugzilla.org <> | 2009-09-30 08:51:45 +0000 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2009-09-30 08:51:45 +0000 |
commit | dc4608b97cec3af3c7028717da291cd5e238a8d4 (patch) | |
tree | 3fafeff51b5f20829950f79afd69a5ff37183cfc /attachment.cgi | |
parent | Bug 519481 - Advanced search has empty version and milestone (diff) | |
download | bugzilla-dc4608b97cec3af3c7028717da291cd5e238a8d4.tar.gz bugzilla-dc4608b97cec3af3c7028717da291cd5e238a8d4.tar.bz2 bugzilla-dc4608b97cec3af3c7028717da291cd5e238a8d4.zip |
Bug 328628: When attachments have UTF-8 characters in their name, they will now be downloaded with the correct name.
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=Wurblzap, a=mkanat
Diffstat (limited to 'attachment.cgi')
-rwxr-xr-x | attachment.cgi | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/attachment.cgi b/attachment.cgi index 32f6e5ec0..2e952746e 100755 --- a/attachment.cgi +++ b/attachment.cgi @@ -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 @@ -318,6 +320,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\"", |