From e328c0a40ed7f7016b62119e3916381111df7f1e Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 10 Feb 2014 15:40:23 +0100 Subject: [PATCH] [FIX] html_sanitize: partial backport of trunk revision 5047. Unescape elements that have been wrongly escaped. Some elements (eg: 'href' tag in links) are sanitised in templates which prevents the execution of mako templates. lp bug: https://launchpad.net/bugs/1273251 fixed bzr revid: mat@openerp.com-20140210144023-9sp8cqn07ta5o64y --- openerp/tools/mail.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openerp/tools/mail.py b/openerp/tools/mail.py index eb13f6eb7fb..1f3e9c1b019 100644 --- a/openerp/tools/mail.py +++ b/openerp/tools/mail.py @@ -68,6 +68,15 @@ def html_sanitize(src): return "" _logger.warning('html_sanitize failed to parse %s' % (src)) cleaned = '

Impossible to parse

' + + # MAKO compatibility: $, { and } inside quotes are escaped, preventing correct mako execution + cleaned = cleaned.replace('%24', '$') + cleaned = cleaned.replace('%7B', '{') + cleaned = cleaned.replace('%7D', '}') + cleaned = cleaned.replace('%20', ' ') + cleaned = cleaned.replace('%5B', '[') + cleaned = cleaned.replace('%5D', ']') + return cleaned