public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Mira Limbeck <m.limbeck@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: Re: [pmg-devel] [RFC PATCH pmg-api 1/1] api: quarantine: allow disabling images for content
Date: Wed, 21 Feb 2024 15:12:37 +0100	[thread overview]
Message-ID: <3dbf20ec-a4fb-4254-bf81-59a6617ab502@proxmox.com> (raw)
In-Reply-To: <20240213113050.2349660-2-d.csapak@proxmox.com>

On 2/13/24 12:30, Dominik Csapak wrote:
> 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@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';

Since `view-images` only has an effect when format equals `htmlmail`,
should this be noted in the description?

Works as described, so consider this:

Tested-by: Mira Limbeck <m.limbeck@proxmox.com>




  reply	other threads:[~2024-02-21 14:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13 11:30 [pmg-devel] [RFC PATCH pmg-api/gui] add 'view images' checkbox to quarantine view Dominik Csapak
2024-02-13 11:30 ` [pmg-devel] [RFC PATCH pmg-api 1/1] api: quarantine: allow disabling images for content Dominik Csapak
2024-02-21 14:12   ` Mira Limbeck [this message]
2024-02-13 11:30 ` [pmg-devel] [RFC PATCH pmg-gui 1/1] quarantine content: add checkbox for controlling image loading Dominik Csapak
2024-02-21 14:17   ` Mira Limbeck
2024-02-21 18:51 ` [pmg-devel] [RFC PATCH pmg-api/gui] add 'view images' checkbox to quarantine view Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3dbf20ec-a4fb-4254-bf81-59a6617ab502@proxmox.com \
    --to=m.limbeck@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal