[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.8-54-g6a9eed7

? sunnavy sunnavy at bestpractical.com
Mon May 17 05:19:29 EDT 2010


The branch, 3.8-trunk has been updated
       via  6a9eed7921905e1344d12d1ef51c6a414f6ce914 (commit)
      from  3c82cc42c9e1b0eac7421e97aa79210edadce8cc (commit)

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

- Log -----------------------------------------------------------------
commit 6a9eed7921905e1344d12d1ef51c6a414f6ce914
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon May 17 17:19:50 2010 +0800

    tweak Type arg of Transactio::Content(Obj): we never respect text/plain, just use the textual one, see also #14420

diff --git a/lib/RT/Transaction_Overlay.pm b/lib/RT/Transaction_Overlay.pm
index 96ccf51..a3bcaba 100755
--- a/lib/RT/Transaction_Overlay.pm
+++ b/lib/RT/Transaction_Overlay.pm
@@ -292,21 +292,23 @@ If $args{'Type'} is set to C<text/html>, this will return an HTML
 part of the message, if available.  Otherwise it looks for a text/plain
 part. If $args{'Type'} is missing, it defaults to the value of 
 C<$RT::Transaction::PreferredContentType>, if that's missing too, 
-defaults to 'text/plain'.
+defaults to the first textual one.
 
 =cut
 
 sub Content {
     my $self = shift;
     my %args = (
-        Type  => $PreferredContentType || 'text/plain',
+        Type => undef,
         Quote => 0,
         Wrap  => 70,
         @_
     );
 
     my $content;
-    if ( my $content_obj = $self->ContentObj( Type => $args{Type} ) ) {
+    if ( my $content_obj =
+        $self->ContentObj( $args{Type} ? ( Type => $args{Type} ) : () ) )
+    {
         $content = $content_obj->Content ||'';
 
         if ( lc $content_obj->ContentType eq 'text/html' ) {
@@ -397,8 +399,7 @@ Returns the RT::Attachment object which contains the content for this Transactio
 
 sub ContentObj {
     my $self = shift;
-    my %args = ( Type => $PreferredContentType || 'text/plain',
-                 @_ );
+    my %args = ( Type => $PreferredContentType, @_ );
 
     # If we don't have any content, return undef now.
     # Get the set of toplevel attachments to this transaction.
@@ -413,13 +414,15 @@ sub ContentObj {
     # MIME type ('text/plain' by default).
 
     elsif ( $Attachment->ContentType =~ '^multipart/' ) {
-        my $plain_parts = $Attachment->Children;
-        $plain_parts->ContentType( VALUE => $args{Type} );
-        $plain_parts->LimitNotEmpty;
-
-        # If we actully found a part, return its content
-        if ( my $first = $plain_parts->First ) {
-            return $first;
+        if ( $args{Type} ) {
+            my $plain_parts = $Attachment->Children;
+            $plain_parts->ContentType( VALUE => $args{Type} );
+            $plain_parts->LimitNotEmpty;
+
+            # If we actully found a part, return its content
+            if ( my $first = $plain_parts->First ) {
+                return $first;
+            }
         }
 
         # If that fails, return the first textual part which has some content.

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


More information about the Rt-commit mailing list