[IMP] tools mail: don't remove xml and doctype but remove encoding attribute

bzr revid: chm@openerp.com-20121219124038-05bf07960h05x0o8
This commit is contained in:
Christophe Matthieu
2012-12-19 13:40:38 +01:00
parent a31af13a3e
commit 111e080e48
+2 -2
View File
@@ -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. <br[ /]> -> \n, because otherwise the tree is obfuscated