]> git.proxmox.com Git - pmg-api.git/commitdiff
ruledb: modfield: properly encode field after variable substitution
authorStoiko Ivanov <s.ivanov@proxmox.com>
Wed, 9 Nov 2022 18:27:24 +0000 (19:27 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 11 Nov 2022 12:46:00 +0000 (13:46 +0100)
this patch follows 6296d93fecb84e71603c15218f6ffc9732173491 in
properly encoding the added header-field, the way the subject is
encoded for a notification.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
src/PMG/RuleDB/ModField.pm

index 3e66ac33e0afa64e6a7eb71bde7cf3f5823307c3..fb15076cc97396e9248f860e24072dc7d4f0e9f8 100644 (file)
@@ -4,6 +4,8 @@ use strict;
 use warnings;
 use DBI;
 use Digest::SHA;
+use Encode qw(encode decode);
+use MIME::Words qw(encode_mimewords);
 
 use PMG::Utils;
 use PMG::ModGroup;
@@ -107,7 +109,7 @@ sub execute {
 
     foreach my $ta (@$subgroups) {
        my ($tg, $e) = (@$ta[0], @$ta[1]);
-       $e->head->replace($self->{field}, $fvalue);
+       $e->head->replace($self->{field}, encode_mimewords(encode('UTF-8', $fvalue), "Charset" => "UTF-8"));
     }
 }