From cd527b939456dbfdb4aeda266194495832fbbcf7 Mon Sep 17 00:00:00 2001 From: Antoine Guenet Date: Thu, 17 Aug 2023 15:14:19 +0000 Subject: [PATCH] [FIX] mail: replace local url of background image with single quotes Relative image urls have to be replaced with absolute urls in order to be able to display them in the email. This failed to be done for urls in styles attributes if they were enclosed in (unicode decimal) single quotes. opw-3452655 closes odoo/odoo#132339 X-original-commit: d952e0117a68dd19e86c45ae75250807231e82ad Signed-off-by: David Monjoie (dmo) --- addons/mail/models/mail_render_mixin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mail/models/mail_render_mixin.py b/addons/mail/models/mail_render_mixin.py index fdb6d76de1e..331816941e2 100644 --- a/addons/mail/models/mail_render_mixin.py +++ b/addons/mail/models/mail_render_mixin.py @@ -154,9 +154,9 @@ class MailRenderMixin(models.AbstractModel): r"""( # Group 1: element up to url in style <[^>]+\bstyle=" # Element with a style attribute [^"]+\burl\( # Style attribute contains "url(" style - (?:&\#34;|'|")?) # url style may start with (escaped) quote: capture it + (?:&\#34;|'|"|&\#39;)?) # url style may start with (escaped) quote: capture it ( # Group 2: url itself - /(?:[^'")]|(?!&\#34;))+ # stop at the first closing quote + /(?:[^'")]|(?!&\#34;)|(?!&\#39;))+ # stop at the first closing quote )""", re.VERBOSE), _sub_relative2absolute, html) return wrapper(html)