[Rt-commit] rt branch, 4.2/rt-forward-encoding, repushed

Wallace Reis wreis at bestpractical.com
Thu Nov 13 17:13:19 EST 2014


The branch 4.2/rt-forward-encoding was deleted and repushed:
       was f5f4e55d03b70e7b1c57d3e58080113c051f847a
       now 7c95ce15e07a4614638916e5d33828f3c6bef830

1:  f5f4e55 ! 1:  7c95ce1 Forwarded messages break attachments with non-ASCII filenames
    @@ -8,7 +8,9 @@
         it has any.
         
         This aim to fix by applying the correct encoding according to rfc2231
    -    before assemblying the MIME object.
    +    before assembling the MIME object. It worths mentioning that we are not
    +    using MIME::Field::ParamVal to assemble the parts, because at the moment
    +    it doesn't know how to do so correctly.
         
         Fixes: #29753.
     
    @@ -19,7 +21,6 @@
      use MIME::QuotedPrint;
      use MIME::Body;
      use RT::Util 'mime_recommended_filename';
    -+use Encode ();
     +use URI;
      
      sub _OverlayAccessible {
    @@ -30,16 +31,16 @@
      
     +sub _EncodeHeaderToMIME {
     +    my ( $self, $header_name, $header_val ) = @_;
    -+    my $encode_header = sub {
    -+        return q{UTF-8''} . URI->new( Encode::encode('UTF-8', shift) );
    -+    };
     +    if ($header_name =~ /^Content-/i) {
     +        my $params = MIME::Field::ParamVal->parse_params($header_val);
     +        $header_val = delete $params->{'_'};
     +        foreach my $key ( sort keys %$params ) {
     +            my $value = $params->{$key};
     +            if ( $value =~ /[^\x00-\x7f]/ ) { # check for non-ASCII
    -+                $value = $encode_header->($value);
    ++                $value = q{UTF-8''} . URI->new(
    ++                    Encode::encode('UTF-8', $value)
    ++                );
    ++                $value =~ s/(["\\])/\\$1/g;
     +                $header_val .= qq{; ${key}*="$value"};
     +            }
     +            else {



More information about the rt-commit mailing list