[Rt-commit] rt branch, 4.4/txn-content-skip-mime-attachments, repushed

? sunnavy sunnavy at bestpractical.com
Fri Aug 14 15:13:41 EDT 2020


The branch 4.4/txn-content-skip-mime-attachments was deleted and repushed:
       was 7ac5b6859a7a095283bbfa9c4a7e604642c9b157
       now 2505933f070b68f0bc59feb4e060f59c05359eb6

1: d6d4629df5 ! 1: 5dc91ca147 Exclude MIME attachments when questing a transaction's content
    @@ -4,6 +4,29 @@
         
         It doesn't make sense to use MIME attachments' content here, what we
         really want is the main body of the MIME.
    +
    +diff --git a/lib/RT/Attachment.pm b/lib/RT/Attachment.pm
    +--- a/lib/RT/Attachment.pm
    ++++ b/lib/RT/Attachment.pm
    +@@
    +     return $self->ContentType =~ m{^\s*message/}i ? 1 : 0;
    + }
    + 
    ++=head2 IsAttachmentContentDisposition
    ++
    ++Returns a boolean indicating if the Content-Disposition of this attachment
    ++is a MIME attachment.
    ++
    ++=cut
    ++
    ++sub IsAttachmentContentDisposition {
    ++    my $self = shift;
    ++    return ( $self->GetHeader('Content-Disposition') // '' ) =~ m{^\s*attachment\b}i ? 1 : 0;
    ++}
    ++
    + =head2 Addresses
    + 
    + Returns a hashref of all addresses related to this attachment.
     
     diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
     --- a/lib/RT/Transaction.pm
    @@ -26,7 +49,7 @@
     -        && $part->Content;
     +        next unless _IsDisplayableTextualContentType( $part->ContentType )
     +          && !$part->Filename
    -+          && ( $part->GetHeader('Content-Disposition') // '' ) !~ /^\s*attachment\b/i
    ++          && !$part->IsAttachmentContentDisposition
     +          && $part->Content;
              return $part;
          }
    @@ -37,7 +60,7 @@
      
     +    # If it's a MIME attachment, return undef.
     +    return undef if $Attachment->Filename;
    -+    return undef if ( $Attachment->GetHeader('Content-Disposition') // '' ) =~ /^\s*attachment\b/i;
    ++    return undef if $Attachment->IsAttachmentContentDisposition;
     +
          # If it's a textual part, just return the body.
          if ( _IsDisplayableTextualContentType($Attachment->ContentType) ) {
2: 7ac5b6859a = 2: 2505933f07 Add tests for transaction content



More information about the rt-commit mailing list