From 111e080e48682c1e8fb98c061b4acf07e2852b57 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 19 Dec 2012 13:40:38 +0100 Subject: [PATCH] [IMP] tools mail: don't remove xml and doctype but remove encoding attribute bzr revid: chm@openerp.com-20121219124038-05bf07960h05x0o8 --- openerp/tools/mail.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openerp/tools/mail.py b/openerp/tools/mail.py index 9df7499d0c8..e6b471a26ba 100644 --- a/openerp/tools/mail.py +++ b/openerp/tools/mail.py @@ -135,8 +135,8 @@ def html_email_clean(html): html = ustr(html) - # 0. remove doctype and xml tags - doctype = re.compile(r"(<[?]xml.*?[?]>|<[!]DOCTYPE.*?>)[\n\r\s]*", re.IGNORECASE | re.DOTALL) + # 0. remove encoding attribute inside tags + doctype = re.compile(r'(<[^>]*\s)(encoding=(["\'][^"\']*?["\']|[^\s\n\r>]+)(\s[^>]*|/)?>)', re.IGNORECASE | re.DOTALL) html = doctype.sub(r"", html) # 1. -> \n, because otherwise the tree is obfuscated