From d595e3a258f5f1f45b0b3dcf4ab43fdfebc83d40 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Tue, 8 May 2018 16:46:23 +0200 Subject: [PATCH] [FIX] tools: mail transcoding css space consistent The transcoding of a mail (transforming CSS into inline styles on the element nodes of the mail) used the form: property:value; So when a mail is saved, it would be eg. with `style="property:value;"` and when it is being edited "property:value" is removed if available via CSS stylesheet given the structure. But the sanitize_style (introduced in bfe7aafa7) adds an espace before the value (which is more pretty but was probably not choosen in transcoding to decrease size of mail): property: value; so the inline style would not be removed when editing possibly causing conflict with the editor. With this commit, the sanitize_style doesn't add a space. It could have been changed in transcoding but the code is already rather slow and we don't want to use a regex replace or two string replace instead of the current one string replace. opw-1841107 --- odoo/addons/base/tests/test_mail.py | 4 ++-- odoo/addons/base/tests/test_mail_examples.py | 2 +- odoo/tools/mail.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/odoo/addons/base/tests/test_mail.py b/odoo/addons/base/tests/test_mail.py index 795d6824886..b94ebf57183 100644 --- a/odoo/addons/base/tests/test_mail.py +++ b/odoo/addons/base/tests/test_mail.py @@ -115,7 +115,7 @@ class TestSanitizer(unittest.TestCase): test_data = [ ( 'Coin coin ', - ['background-color: red', 'Coin coin'], + ['background-color:red', 'Coin coin'], ['position', 'top', 'left'] ), ( """
youplaboum
""", - ['font-size: 30px', 'youplaboum'], + ['font-size:30px', 'youplaboum'], ['some-property', 'top', 'cheval'] ), ( 'Coincoin', diff --git a/odoo/addons/base/tests/test_mail_examples.py b/odoo/addons/base/tests/test_mail_examples.py index a83e668d940..fcd83524fc0 100644 --- a/odoo/addons/base/tests/test_mail_examples.py +++ b/odoo/addons/base/tests/test_mail_examples.py @@ -510,7 +510,7 @@ REMOVE_CLASS = """ """ REMOVE_CLASS_IN = [ - '
', + '
', 'An error occured in a modal and I will send you back the html to try opening one on your end'] REMOVE_CLASS_OUT = [ '