[Rt-commit] rt branch, 4.2-trunk, updated. rt-4.2.10-141-gdb237d3

Alex Vandiver alexmv at bestpractical.com
Thu Mar 5 19:03:46 EST 2015


The branch, 4.2-trunk has been updated
       via  db237d38b600375a3e5b71be474b910365980db6 (commit)
       via  3488f2ead8eab2cf615b47d1532193c4d2ad631a (commit)
      from  15fe8b6279fce2cd1f704293fa81de1dc2030e3f (commit)

Summary of changes:
 lib/RT/Interface/REST.pm | 6 ++++++
 1 file changed, 6 insertions(+)

- Log -----------------------------------------------------------------
commit 3488f2ead8eab2cf615b47d1532193c4d2ad631a
Author: Przemyslaw Plewa <przemyslaw.plewa at domena.pl>
Date:   Fri Feb 6 13:50:11 2015 +0100

    Use Content-ID when handling multipart message over REST.
    
    Record Content-ID identifier that came over REST API.
    
    This allows us to have multipart messages with one (or more) part
    refering to other parts of message. Content-ID identifier is used for
    reference.
    
    Such message also needs multipart/related type (instead of default (in
    rt) multipart/mixed. So if we detect Content-ID in any part of multipart
    message we switch Content-Type to multipart/related.
    
    Signed-off-by: Przemysław Plewa <przemyslaw.plewa at domena.pl>

diff --git a/lib/RT/Interface/REST.pm b/lib/RT/Interface/REST.pm
index edfc5d3..1c8f555 100644
--- a/lib/RT/Interface/REST.pm
+++ b/lib/RT/Interface/REST.pm
@@ -324,11 +324,17 @@ sub process_attachments {
         }
 
         my $info = $cgi->uploadInfo($fh);
+        # If Content-ID exists for attachment then we need multipart/related
+        # to be able to refer to this Content-Id in core of mime message
+        if($info->{'Content-ID'}) {
+            $entity->head->set('Content-Type', 'multipart/related');
+        }
         my $new_entity = $entity->attach(
             Path => $tmp_fn,
             Type => $info->{'Content-Type'} || guess_media_type($tmp_fn),
             Filename => $file,
             Disposition => $info->{'Content-Disposition'} || "attachment",
+            'Content-ID' => $info->{'Content-ID'},
         );
         $new_entity->bodyhandle->{'_dirty_hack_to_save_a_ref_tmp_fh'} = $tmp_fh;
         $i++;

commit db237d38b600375a3e5b71be474b910365980db6
Merge: 15fe8b6 3488f2e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Mar 5 19:03:19 2015 -0500

    Merge branch '4.2/rest-content-id' into 4.2-trunk


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


More information about the rt-commit mailing list