[Bps-public-commit] rt-extension-onetimeto branch, master, updated. 7812d854f80586847670adca4f416093d725a413

Thomas Sibley trs at bestpractical.com
Thu Jul 28 14:54:23 EDT 2011


The branch, master has been updated
       via  7812d854f80586847670adca4f416093d725a413 (commit)
      from  01a3bd4d3d000c280d5c468ae43859524aa97e0c (commit)

Summary of changes:
 lib/RT/Extension/OneTimeTo.pm |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit 7812d854f80586847670adca4f416093d725a413
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Jul 28 14:52:28 2011 -0400

    Defer to the original _RecordNote method when we have no message
    
    This fixes an edge case bug that would let empty messages be recorded
    since we blindly generated a MIMEObj and passed it to the original
    method.

diff --git a/lib/RT/Extension/OneTimeTo.pm b/lib/RT/Extension/OneTimeTo.pm
index 37ac6ea..6e5f469 100644
--- a/lib/RT/Extension/OneTimeTo.pm
+++ b/lib/RT/Extension/OneTimeTo.pm
@@ -45,6 +45,12 @@ my $orig_note = RT::Ticket->can('_RecordNote');
     my $self = shift;
     my %args = @_;
 
+    # We can't do anything if we don't have any message, so let the original
+    # method handle it rather than creating an empty mime body
+    unless ( $args{'MIMEObj'} || $args{'Content'} ) {
+        return $orig_note->($self, %args);
+    }
+
     # lazily initialize the MIMEObj if needed; copied from original method
     unless ( $args{'MIMEObj'} ) {
         $args{'MIMEObj'} = MIME::Entity->build(
@@ -62,6 +68,7 @@ my $orig_note = RT::Ticket->can('_RecordNote');
         $args{'MIMEObj'}->head->add( 'RT-Send-' . $type, Encode::encode_utf8( $addresses ) );
     }
 
+    # The original method will always get a MIMEObj now
     return $orig_note->($self, %args);
 };
 

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



More information about the Bps-public-commit mailing list