[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) <dmo@odoo.com>
This commit is contained in:
Antoine Guenet
2023-08-19 12:01:52 +02:00
parent 6624cbf75b
commit cd527b9394
+2 -2
View File
@@ -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;|'|&quot;)?) # url style may start with (escaped) quote: capture it
(?:&\#34;|'|&quot;|&\#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)