]> git.proxmox.com Git - pmg-api.git/blobdiff - PMG/HTMLMail.pm
fix schema definition
[pmg-api.git] / PMG / HTMLMail.pm
index 90adb5f9fea73c0f7697eaede5392f97678a3f13..e30ede126100791e94e7202d79cf5f60715338e3 100644 (file)
@@ -81,6 +81,7 @@ sub getscrubber {
            alt => 1,
            axis => 1,
            border => 1,
+           bgcolor => 1,
            cellpadding => 1,
            cellspacing => 1,
            char => 1,
@@ -215,9 +216,7 @@ my $read_part = sub {
 };
 
 my $find_images = sub {
-    my ($entity) = @_;
-
-    my $res = {};
+    my ($cid_hash, $entity) = @_;
 
     foreach my $part ($entity->parts)  {
        if (my $rawcid = $part->head->get('Content-Id')) {
@@ -226,14 +225,12 @@ my $find_images = sub {
                my $ctype = $part->head->mime_attr('Content-type') // '';
                if ($ctype =~ m!^image/!) {
                    if (defined(my $raw = $read_part->($part))) {
-                       $res->{$cid} = "data:$ctype;base64," . encode_base64($raw, '');
+                       $cid_hash->{$cid} = "data:$ctype;base64," . encode_base64($raw, '');
                    }
                }
            }
        }
     }
-
-    return $res;
 };
 
 sub entity_to_html {
@@ -287,11 +284,11 @@ sub entity_to_html {
        }
 
        # get related/embedded images as data uris
-       my $cid_hash = $find_images->($entity);
+       $find_images->($cid_hash, $entity);
 
        my $alt = $multi_part || $html_part || $text_part;
 
-       return entity_to_html ($alt, $cid_hash, $viewimages, $allowhref) if $alt;
+       return entity_to_html($alt, $cid_hash, $viewimages, $allowhref) if $alt;
     }
 
     return undef;