public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup v2 3/5] server/email_notifications: do not double html escape
Date: Thu, 18 Mar 2021 13:01:06 +0100	[thread overview]
Message-ID: <20210318120108.26423-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20210318120108.26423-1-d.csapak@proxmox.com>

the default escape handler is handlebars::html_escape, but this are
plain text emails and we manually escape them for the html part, so
set the default escape handler to 'no_escape'

this avoids double html escape for the characters: '&"<>' in emails

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/server/email_notifications.rs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/server/email_notifications.rs b/src/server/email_notifications.rs
index cd5a43fe..e92c8091 100644
--- a/src/server/email_notifications.rs
+++ b/src/server/email_notifications.rs
@@ -185,6 +185,7 @@ lazy_static::lazy_static!{
         let result: Result<(), TemplateError> = try_block!({
 
             hb.set_strict_mode(true);
+            hb.register_escape_fn(handlebars::no_escape);
 
             hb.register_helper("human-bytes", Box::new(handlebars_humam_bytes_helper));
             hb.register_helper("relative-percentage", Box::new(handlebars_relative_percentage_helper));
-- 
2.20.1





  parent reply	other threads:[~2021-03-18 12:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 12:01 [pbs-devel] [PATCH proxmox-backup v2 0/5] improve tape backup and notifications Dominik Csapak
2021-03-18 12:01 ` [pbs-devel] [PATCH proxmox-backup v2 1/5] tools/systemd/time: implement some Traits for TimeSpan Dominik Csapak
2021-03-18 12:01 ` [pbs-devel] [PATCH proxmox-backup v2 2/5] server/email_notifications: do not panic on template registration Dominik Csapak
2021-03-18 12:01 ` Dominik Csapak [this message]
2021-03-18 12:01 ` [pbs-devel] [PATCH proxmox-backup v2 4/5] api2/tape/backup: include a summary on notification e-mails Dominik Csapak
2021-03-19  6:07   ` Dietmar Maurer
2021-03-18 12:01 ` [pbs-devel] [PATCH proxmox-backup v2 5/5] api2/tape/backup: wait indefinitely for lock in scheduled backup jobs Dominik Csapak
2021-03-19  6:09 ` [pbs-devel] [PATCH proxmox-backup v2 0/5] improve tape backup and notifications Dietmar Maurer

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=20210318120108.26423-4-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-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