[Rt-commit] rt branch, 4.2-trunk, updated. rt-4.2.10-217-gd7a6f02

Alex Vandiver alexmv at bestpractical.com
Wed Mar 18 18:03:02 EDT 2015


The branch, 4.2-trunk has been updated
       via  d7a6f02708279b505cdbf6cd87c233242624830e (commit)
       via  b56cf8e3daac89ceb08554ff85b218ffccb6fe7c (commit)
      from  27102d826990cfe49568efb2074575afe6c5862c (commit)

Summary of changes:
 etc/upgrade/4.2.11/content | 18 ++++++++++++++++++
 lib/RT/Ticket.pm           |  7 +++----
 t/web/ticket_forward.t     | 19 +++++++++++++++++++
 3 files changed, 40 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit d7a6f02708279b505cdbf6cd87c233242624830e
Merge: 27102d8 b56cf8e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Mar 18 18:02:46 2015 -0400

    Merge branch '4.2/do-not-encode-mime-headers-in-forward-method' into 4.2-trunk

diff --cc etc/upgrade/4.2.11/content
index 9c60f80,f84dc04..883b519
--- a/etc/upgrade/4.2.11/content
+++ b/etc/upgrade/4.2.11/content
@@@ -13,29 -13,21 +13,47 @@@ our @Initial = 
  EOSQL
      },
      sub {
 +        # Remove globally-granted role rights which couldn't also apply
 +        # to some other object.  That is, globally granting that
 +        # AdminCcs have SuperUser makes no sense.
 +
 +        # Find rights which apply globally
 +        no warnings 'once';
 +        my @rights = sort map {$_->{Name}} values %{$RT::ACE::RIGHTS{'RT::System'}};
 +
 +        # Those are not allowed to be granted on global role groups
 +        my $invalid = RT::ACL->new( RT->SystemUser );
 +        $invalid->LimitToObject( 'RT::System' );
 +        $invalid->LimitToPrincipal( Id => RT::System->RoleGroup($_)->PrincipalId )
 +            for RT::System->Roles;
 +        $invalid->Limit( FIELD => 'RightName', OPERATOR => 'IN', VALUE => \@rights );
 +
 +        return unless $invalid->Count;
 +
 +        # Remove them, warning in the process
 +        $RT::Logger->warning("There are invalid global role rights; removing:");
 +        while (my $right = $invalid->Next) {
 +            $RT::Logger->warning("  ".$right->RightName." granted globally to ".$right->PrincipalObj->Object->Name);
 +            my ($ok, $msg) = $right->Delete;
 +            $RT::Logger->error("Failed to remove right ".$right->id.": $msg") unless $ok;
 +        }
 +    },
++    sub {
+         my $txns = RT::Transactions->new(RT->SystemUser);
+         $txns->Limit( FIELD => 'Type', VALUE => 'Forward Transaction' );
+         $txns->Limit( FIELD => 'Type', VALUE => 'Forward Ticket' );
+         while ( my $txn = $txns->Next ) {
+             my $att = $txn->Attachments->First;
+ 
+             # we only need to process ascii-only strings
+             unless ( $att->Subject =~ /[^\x00-\x7F]/ ) {
+                 $att->__Set( Field => 'Subject', Value => Encode::decode("UTF-8", RT::I18N::DecodeMIMEWordsToUTF8($att->Subject, 'Subject')) );
+             }
+             for my $field ( qw/Subject From To Cc Bcc/ ) {
+                 next if !$att->GetHeader($field) || $att->GetHeader($field) =~ /[^\x00-\x7F]/;
+                 # Subject here is not a typo, because we don't really want to parse email addresses here
+                 $att->SetHeader( $field, Encode::decode("UTF-8", RT::I18N::DecodeMIMEWordsToUTF8($att->GetHeader($field), 'Subject')) );
+             }
+         }
+     },
  );

-----------------------------------------------------------------------


More information about the rt-commit mailing list