From a7ff8364ea04c34dedfd8d028c78b941461ec664 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 7 Mar 2017 15:26:09 +0100 Subject: [PATCH] [FIX] mail sanitize: allow extra common style attributes Without allowing these harmless style attributes, sending mass mailing emails with the new snippets produced an ugly dumbed-down version. --- odoo/tools/mail.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/odoo/tools/mail.py b/odoo/tools/mail.py index 328fa81465c..cff0779a658 100644 --- a/odoo/tools/mail.py +++ b/odoo/tools/mail.py @@ -42,14 +42,22 @@ class _Cleaner(clean.Cleaner): _style_re = re.compile('''([\w-]+)\s*:\s*((?:[^;"']|"[^"]*"|'[^']*')+)''') _style_whitelist = [ - 'font-size', 'font-family', 'background-color', 'color', 'text-align', + 'font-size', 'font-family', 'font-weight', 'background-color', 'color', 'text-align', + 'line-height', 'letter-spacing', 'text-transform', 'text-decoration', 'padding', 'padding-top', 'padding-left', 'padding-bottom', 'padding-right', 'margin', 'margin-top', 'margin-left', 'margin-bottom', 'margin-right' # box model - 'border', 'border-color', 'border-radius', 'height', 'margin', 'padding', 'width', 'max-width', 'min-width', + 'border', 'border-color', 'border-radius', 'border-style', 'height', + 'margin', 'padding', 'width', 'max-width', 'min-width', # tables 'border-collapse', 'border-spacing', 'caption-side', 'empty-cells', 'table-layout'] + _style_whitelist.extend( + ['border-%s-%s' % (position, attribute) + for position in ['top', 'bottom', 'left', 'right'] + for attribute in ('style', 'color', 'width', 'left-radius', 'right-radius')] + ) + strip_classes = False sanitize_style = False