[Rt-commit] rt branch, 4.2/attach-from-transactions, updated. rt-4.0.1-408-g52dcce0

? sunnavy sunnavy at bestpractical.com
Wed Feb 8 03:35:56 EST 2012


The branch, 4.2/attach-from-transactions has been updated
       via  52dcce0024e9a336666390bc51b856439c303ac8 (commit)
      from  923d73c8660a66f5919fd1c953b448536115e3aa (commit)

Summary of changes:
 lib/RT/Action/SendEmail.pm |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit 52dcce0024e9a336666390bc51b856439c303ac8
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Feb 8 16:05:47 2012 +0800

    email could be multipart already before calling AddAttachmentsFromHeaders
    
    the bug's behavior is: when people select attachments and upload some too at
    the same time, the uploaded attachments will leak to EmailRecord txn, which
    results in duplicates for uploaded ones.
    
    this is because in RT::Action::SendEmail::RecordOutgoingMailTransaction, we
    filter top parts of email by checking their "RT-Attachment" headers, so we
    can't make multipart again if the email is already multipart.

diff --git a/lib/RT/Action/SendEmail.pm b/lib/RT/Action/SendEmail.pm
index 3c32419..665e9a1 100644
--- a/lib/RT/Action/SendEmail.pm
+++ b/lib/RT/Action/SendEmail.pm
@@ -426,7 +426,6 @@ sub AddAttachmentsFromHeaders {
     }
 
     # Take all RT-Attach headers and add the attachments to the outgoing mail
-    my $seen_attachment = 0;
     for my $id (uniq $email->head->get_all('RT-Attach')) {
         $id =~ s/(?:^\s*|\s*$)//g;
 
@@ -435,9 +434,8 @@ sub AddAttachmentsFromHeaders {
         next unless $attach->Id
                 and $attach->TransactionObj->CurrentUserCanSee;
 
-        if ( !$seen_attachment ) {
+        if ( !$email->is_multipart ) {
             $email->make_multipart( 'mixed', Force => 1 );
-            $seen_attachment = 1;
         }
         $self->AddAttachment($attach, $email);
     }

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


More information about the Rt-commit mailing list