diff options
author | feld <feld@FreeBSD.org> | 2018-06-30 06:45:57 +0800 |
---|---|---|
committer | feld <feld@FreeBSD.org> | 2018-06-30 06:45:57 +0800 |
commit | 499fcc46565c17e69f372d097a0c2081b82c9f0f (patch) | |
tree | 7390d5fe2afb45b5197cd428d8b3fa8c925cdb96 /devel/bugzilla50 | |
parent | 6c481c5b9033f2abebc1b2ea0fbb1964087c1804 (diff) | |
download | freebsd-ports-gnome-499fcc46565c17e69f372d097a0c2081b82c9f0f.tar.gz freebsd-ports-gnome-499fcc46565c17e69f372d097a0c2081b82c9f0f.tar.zst freebsd-ports-gnome-499fcc46565c17e69f372d097a0c2081b82c9f0f.zip |
devel/bugzilla50: Backport patch to fix buggy attachment download filenames
PR: 228644
Approved by: maintainer (timeout)
Diffstat (limited to 'devel/bugzilla50')
-rw-r--r-- | devel/bugzilla50/Makefile | 1 | ||||
-rw-r--r-- | devel/bugzilla50/files/patch-PR619847 | 41 |
2 files changed, 42 insertions, 0 deletions
diff --git a/devel/bugzilla50/Makefile b/devel/bugzilla50/Makefile index 72ac926b4b38..2f5c993dc666 100644 --- a/devel/bugzilla50/Makefile +++ b/devel/bugzilla50/Makefile @@ -2,6 +2,7 @@ PORTNAME= bugzilla PORTVERSION= 5.0.4 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= MOZILLA/webtools MOZILLA/webtools/archived diff --git a/devel/bugzilla50/files/patch-PR619847 b/devel/bugzilla50/files/patch-PR619847 new file mode 100644 index 000000000000..978c8ffa53ca --- /dev/null +++ b/devel/bugzilla50/files/patch-PR619847 @@ -0,0 +1,41 @@ +--- attachment.cgi.orig 2018-05-31 17:40:51 UTC ++++ attachment.cgi +@@ -25,8 +25,8 @@ use Bugzilla::Attachment; + use Bugzilla::Attachment::PatchReader; + use Bugzilla::Token; + +-use Encode qw(encode find_encoding); +-use Encode::MIME::Header; # Required to alter Encode::Encoding{'MIME-Q'}. ++use Encode qw(find_encoding); ++use URI::Escape qw(uri_escape_utf8); + + # For most scripts we don't make $cgi and $template global variables. But + # when preparing Bugzilla for mod_perl, this script used these +@@ -341,11 +341,8 @@ sub view { + # escape quotes and backslashes in the filename, per RFCs 2045/822 + $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); ++ # Follow RFC 6266 section 4.1 (which itself points to RFC 5987 section 3.2) ++ $filename = uri_escape_utf8($filename); + + my $disposition = Bugzilla->params->{'allow_attachment_display'} ? 'inline' : 'attachment'; + +@@ -363,8 +360,11 @@ sub view { + } + } + } +- 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; |