[interchange] Fix crash in [email] tag with two attachments, e.g.

Stefan Hornburg interchange-cvs at icdevgroup.org
Fri Nov 12 21:10:26 UTC 2010


commit 60ddcfefe3c2477bffe5d9da8da555154d51aa10
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date:   Fri Nov 12 21:35:55 2010 +0100

    Fix crash in [email] tag with two attachments, e.g.
    
    [email
       to="Ton Verhagen <tverhagen at alamerce.nl>"
       from="Foobar <foobar at example.com>"
       subject="Email with an attachment"
       attach.0="images/test1.png"
       attach.1="images/test2.png"
    
    ]This email has two attachments.[/email]

 code/UserTag/email.tag |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/code/UserTag/email.tag b/code/UserTag/email.tag
index 97b3e9a..c4c9c73 100644
--- a/code/UserTag/email.tag
+++ b/code/UserTag/email.tag
@@ -146,6 +146,21 @@ sub {
 		elsif(ref($att) eq 'HASH') {
 			$att = [ $att ];
 		}
+		elsif(ref($att) eq 'ARRAY') {
+			# turn array of file names into array of hash references
+			my $new_att = [];
+
+			for (@$att) {
+				if (ref($_)) {
+					push (@$new_att, $_);
+				}
+				else {
+					push (@$new_att, {path => $_});
+				}
+			}
+
+			$att = $new_att;
+		}
 
 		$att ||= [];
 



More information about the interchange-cvs mailing list