[pmg-devel] [PATCH pmg-api] check if img tag has actually a 'src' attribute

Dominik Csapak d.csapak at proxmox.com
Wed Mar 4 09:42:34 CET 2020


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 at proxmox.com>
---
 src/PMG/HTMLMail.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PMG/HTMLMail.pm b/src/PMG/HTMLMail.pm
index 668be48..b69a596 100644
--- a/src/PMG/HTMLMail.pm
+++ b/src/PMG/HTMLMail.pm
@@ -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;
 			}
-- 
2.20.1




More information about the pmg-devel mailing list