From owner-svn-ports-head@freebsd.org Fri Jun 29 22:45:58 2018 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9032DFD0204; Fri, 29 Jun 2018 22:45:58 +0000 (UTC) (envelope-from feld@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3CD0F7FC04; Fri, 29 Jun 2018 22:45:58 +0000 (UTC) (envelope-from feld@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3C52271D6; Fri, 29 Jun 2018 22:45:57 +0000 (UTC) (envelope-from feld@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5TMjv27073358; Fri, 29 Jun 2018 22:45:57 GMT (envelope-from feld@FreeBSD.org) Received: (from feld@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5TMjvGe073356; Fri, 29 Jun 2018 22:45:57 GMT (envelope-from feld@FreeBSD.org) Message-Id: <201806292245.w5TMjvGe073356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: feld set sender to feld@FreeBSD.org using -f From: Mark Felder Date: Fri, 29 Jun 2018 22:45:57 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r473591 - in head/devel/bugzilla50: . files X-SVN-Group: ports-head X-SVN-Commit-Author: feld X-SVN-Commit-Paths: in head/devel/bugzilla50: . files X-SVN-Commit-Revision: 473591 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2018 22:45:58 -0000 Author: feld Date: Fri Jun 29 22:45:57 2018 New Revision: 473591 URL: https://svnweb.freebsd.org/changeset/ports/473591 Log: devel/bugzilla50: Backport patch to fix buggy attachment download filenames PR: 228644 Approved by: maintainer (timeout) Added: head/devel/bugzilla50/files/patch-PR619847 (contents, props changed) Modified: head/devel/bugzilla50/Makefile Modified: head/devel/bugzilla50/Makefile ============================================================================== --- head/devel/bugzilla50/Makefile Fri Jun 29 22:03:32 2018 (r473590) +++ head/devel/bugzilla50/Makefile Fri Jun 29 22:45:57 2018 (r473591) @@ -2,6 +2,7 @@ PORTNAME= bugzilla PORTVERSION= 5.0.4 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= MOZILLA/webtools MOZILLA/webtools/archived Added: head/devel/bugzilla50/files/patch-PR619847 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/bugzilla50/files/patch-PR619847 Fri Jun 29 22:45:57 2018 (r473591) @@ -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;