[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.8-197-g1c02719

? sunnavy sunnavy at bestpractical.com
Wed Nov 17 00:06:42 EST 2010


The branch, 3.8-trunk has been updated
       via  1c027193b6315ed8beacbad52ac20745a8d92e91 (commit)
      from  3d58212c5e4317ead98b3773c3d0aa45d87aa7cc (commit)

Summary of changes:
 lib/RT/Transaction_Overlay.pm |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit 1c027193b6315ed8beacbad52ac20745a8d92e91
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Mon Aug 23 19:18:59 2010 -0400

    Fix t/web/ticket_txn_content.t by actually making
    Transaction->ContentObj recurse on multipart/mixed.

diff --git a/lib/RT/Transaction_Overlay.pm b/lib/RT/Transaction_Overlay.pm
index 225ba4a..dd08a61 100755
--- a/lib/RT/Transaction_Overlay.pm
+++ b/lib/RT/Transaction_Overlay.pm
@@ -415,11 +415,16 @@ Returns the RT::Attachment object which contains the content for this Transactio
 
 sub ContentObj {
     my $self = shift;
-    my %args = ( Type => $PreferredContentType, @_ );
+    my %args = ( Type => $PreferredContentType, Attachment => undef, @_ );
 
     # If we don't have any content, return undef now.
     # Get the set of toplevel attachments to this transaction.
-    return undef unless my $Attachment = $self->Attachments->First;
+
+    my $Attachment = $args{'Attachment'};
+
+    $Attachment ||= $self->Attachments->First;
+
+    return undef unless ($Attachment);
 
     # If it's a textual part, just return the body.
     if ( RT::I18N::IsTextualContentType($Attachment->ContentType) ) {
@@ -429,7 +434,14 @@ sub ContentObj {
     # If it's a multipart object, first try returning the first part with preferred
     # MIME type ('text/plain' by default).
 
-    elsif ( $Attachment->ContentType =~ '^multipart/' ) {
+    elsif ( $Attachment->ContentType =~ qr|^multipart/mixed|i ) {
+        my $kids = $Attachment->Children;
+        while (my $child = $kids->Next) {
+            my $ret =  $self->ContentObj(%args, Attachment => $child);
+            return $ret if ($ret);
+        }
+    }
+    elsif ( $Attachment->ContentType =~ qr|^multipart/|i ) {
         if ( $args{Type} ) {
             my $plain_parts = $Attachment->Children;
             $plain_parts->ContentType( VALUE => $args{Type} );

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


More information about the Rt-commit mailing list