summaryrefslogtreecommitdiff
path: root/odoo/addons/base
diff options
context:
space:
mode:
authorXavierDo <xdo@odoo.com>2019-01-17 15:57:47 +0000
committerXavierDo <xdo@odoo.com>2019-01-17 16:21:08 +0000
commit76e085cbb7cdff9d24acf666ffd8b81d0601b626 (patch)
tree33b4d04bc7adbd009c9f33bbfa049096a3d82a6f /odoo/addons/base
parent8781e2e4f8cf2d801d6f7f39a86a3bf63f8ad9da (diff)
[FIX] base: avoid to escape image when src contains @
The content id of an attachement can contains a @, therefore image contained in emails where sometimes escaped by html_sanitize as if they were emails adresses. Task: 1915251 closes odoo/odoo#30326
Diffstat (limited to 'odoo/addons/base')
-rw-r--r--odoo/addons/base/tests/test_mail.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/odoo/addons/base/tests/test_mail.py b/odoo/addons/base/tests/test_mail.py
index 5693906c092..297a32cf67e 100644
--- a/odoo/addons/base/tests/test_mail.py
+++ b/odoo/addons/base/tests/test_mail.py
@@ -281,6 +281,11 @@ class TestSanitizer(unittest.TestCase):
self.assertNotIn('<title>404 - Not Found</title>', html)
self.assertIn('<h1>404 - Not Found</h1>', html)
+ def test_cid_with_at(self):
+ img_tag = '<img src="@">'
+ sanitized = html_sanitize(img_tag, sanitize_tags=False, strip_classes=True)
+ self.assertEqual(img_tag, sanitized, "img with can have cid containing @ and shouldn't be escaped")
+
# ms office is currently not supported, have to find a way to support it
# def test_30_email_msoffice(self):
# new_html = html_sanitize(test_mail_examples.MSOFFICE_1, remove=True)