[pmg-devel] [RFC PATCH pmg-api 1/1] api: quarantine: allow disabling images for content
Dominik Csapak
d.csapak at proxmox.com
Tue Feb 13 12:30:49 CET 2024
So that a client can control if images should be stripped from the
quarantine content, even if the server has 'viewimages' configured to on
in pmg.conf.
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/PMG/API2/Quarantine.pm | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/PMG/API2/Quarantine.pm b/src/PMG/API2/Quarantine.pm
index a100e11..17f1405 100644
--- a/src/PMG/API2/Quarantine.pm
+++ b/src/PMG/API2/Quarantine.pm
@@ -867,6 +867,13 @@ __PACKAGE__->register_method ({
optional => 1,
default => 0,
},
+ 'view-images' => {
+ description => "Controls if images are shown. Has no effect if 'viewimages'"
+ ." is turned off in /etc/pmg/pmg.conf.",
+ type => 'boolean',
+ optional => 1,
+ default => 1,
+ },
},
},
returns => {
@@ -944,6 +951,10 @@ __PACKAGE__->register_method ({
my $cfg = PMG::Config->new();
my $viewimages = $cfg->get('spamquar', 'viewimages');
+
+ # only overwrite with the parameter when it's more strict than the config
+ $viewimages = 0 if !($param->{'view-images'} // 1);
+
my $allowhref = $cfg->get('spamquar', 'allowhrefs');
$res->{content} = PMG::HTMLMail::email_to_html($path, $raw, $viewimages, $allowhref) // 'unable to parse mail';
--
2.30.2
More information about the pmg-devel
mailing list