[Rt-commit] rt branch, 4.2/contentasmime-multipart, created. rt-4.2.3-87-g64ce69b

Alex Vandiver alexmv at bestpractical.com
Fri Apr 18 20:58:13 EDT 2014


The branch, 4.2/contentasmime-multipart has been created
        at  64ce69b8a381f0aa13d3d3db2d67723775303742 (commit)

- Log -----------------------------------------------------------------
commit 64ce69b8a381f0aa13d3d3db2d67723775303742
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Apr 18 20:56:44 2014 -0400

    Stop putting a charset and body on multipart messages in ContentAsMIME
    
    Fixes I#23671

diff --git a/lib/RT/Attachment.pm b/lib/RT/Attachment.pm
index 800f4f5..70951a2 100644
--- a/lib/RT/Attachment.pm
+++ b/lib/RT/Attachment.pm
@@ -482,22 +482,23 @@ sub ContentAsMIME {
         my ($h_key, $h_val) = split /:/, $header, 2;
         $entity->head->add( $h_key, RT::Interface::Email::EncodeToMIME( String => $h_val ) );
     }
-    
-    # since we want to return original content, let's use original encoding
-    $entity->head->mime_attr(
-        "Content-Type.charset" => $self->OriginalEncoding )
-      if $self->OriginalEncoding;
-
-    $entity->bodyhandle(
-        MIME::Body::Scalar->new( $self->OriginalContent )
-    );
 
-    if ($opts{'Children'} and not $self->IsMessageContentType) {
-        my $children = $self->Children;
-        while (my $child = $children->Next) {
-            $entity->make_multipart unless $entity->is_multipart;
-            $entity->add_part( $child->ContentAsMIME(%opts) );
+    if ($entity->is_multipart) {
+        if ($opts{'Children'} and not $self->IsMessageContentType) {
+            my $children = $self->Children;
+            while (my $child = $children->Next) {
+                $entity->add_part( $child->ContentAsMIME(%opts) );
+            }
         }
+    } else {
+        # since we want to return original content, let's use original encoding
+        $entity->head->mime_attr(
+            "Content-Type.charset" => $self->OriginalEncoding )
+          if $self->OriginalEncoding;
+
+        $entity->bodyhandle(
+            MIME::Body::Scalar->new( $self->OriginalContent )
+        );
     }
 
     return $entity;

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


More information about the rt-commit mailing list