]> git.proxmox.com Git - pmg-api.git/commitdiff
check if img tag has actually a 'src' attribute
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 4 Mar 2020 08:42:34 +0000 (09:42 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 9 Mar 2020 11:04:58 +0000 (12:04 +0100)
otherwise the journal gets flooded with

  Use of uninitialized value in pattern match (m//) [...]

when the user opens a preview which contains img tags without src attribute

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/PMG/HTMLMail.pm

index 668be48c223ee13244c184f304c7ed25138b8def..b69a59642b8668c85657842ac3c8901d691127d4 100644 (file)
@@ -32,7 +32,7 @@ sub dump_html {
                $node->{target} = '_blank' if $tag eq 'a';
 
                if ($tag eq 'img') {
-                   if ($node->{src} =~ m/^cid:(\S+)$/) {
+                   if ($node->{src} && $node->{src} =~ m/^cid:(\S+)$/) {
                        if (my $datauri = $cid_hash->{$1}) {
                            $node->{src} = $datauri;
                        }