Projet

Général

Profil

Development #51374

misc: absence de {% autoescape %} dans certains templates de mail

Ajouté par Benjamin Dauvergne il y a environ 3 ans. Mis à jour il y a environ 3 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Catégorie:
-
Version cible:
-
Début:
23 février 2021
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:
Non

Description

Ça semble avoir été rendu visible par un changement dans la façon de parser les query-string dans Django 2.2.19 (https://docs.djangoproject.com/en/3.1/releases/2.2.19/).


Fichiers


Demandes liées

Dupliqué par Authentic 2 - Bug #51376: build jenkins en échecRejeté23 février 2021

Actions

Révisions associées

Révision 562cb434 (diff)
Ajouté par Benjamin Dauvergne il y a environ 3 ans

misc: use non-autoescaping template render for email text bodies and subjects (#51374)

Historique

#1

Mis à jour par Benjamin Dauvergne il y a environ 3 ans

#2

Mis à jour par Benjamin Dauvergne il y a environ 3 ans

  • Dupliqué par Bug #51376: build jenkins en échec ajouté
#4

Mis à jour par Valentin Deniaud il y a environ 3 ans

  • Statut changé de Solution proposée à En cours

(toujours rouge)

#5

Mis à jour par Benjamin Dauvergne il y a environ 3 ans

Sans modifier la configuration globale c'est moins fatiguant.

#6

Mis à jour par Valentin Deniaud il y a environ 3 ans

Pas fan du tout de ce render_plain_text_template_to_string, je préférais le premier patch. Sinon sans toucher aux backends cette approche semble fonctionner :

@@ -664,2 +665,3 @@ def send_templated_mail(user_or_email, template_names, context=None, with_html=T
         ctx.update(context)
+    plain_text_ctx = make_context(ctx, request=request, autoescape=False)

@@ -667,3 +669,4 @@ def send_templated_mail(user_or_email, template_names, context=None, with_html=T
     subject_template_names += legacy_subject_templates or []
-    subject = render_plain_text_template_to_string(subject_template_names, ctx, request=request).strip()
+    template = select_template(subject_template_names)
+    subject = template.template.render(plain_text_ctx).strip()

@@ -671,3 +674,4 @@ def send_templated_mail(user_or_email, template_names, context=None, with_html=T
     body_template_names += legacy_body_templates or []
-    body = render_plain_text_template_to_string(body_template_names, ctx, request=request)
+    template = select_template(body_template_names)
+    body = template.template.render(plain_text_ctx)
#8

Mis à jour par Valentin Deniaud il y a environ 3 ans

  • Statut changé de Solution proposée à Solution validée
#9

Mis à jour par Benjamin Dauvergne il y a environ 3 ans

  • Statut changé de Solution validée à Résolu (à déployer)
commit 562cb43476921eb071ad67161d9461b7d09e9c3c
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Tue Feb 23 16:25:37 2021 +0100

    misc: use non-autoescaping template render for email text bodies and subjects (#51374)
#10

Mis à jour par Frédéric Péters il y a environ 3 ans

  • Statut changé de Résolu (à déployer) à Solution déployée

Formats disponibles : Atom PDF