[FIX] mail: better signature detection

This revision back-ports revisions
983d5eb9fa
&
ccbb8e09a6
regarding this signature regex.

Besides, it adds the fact the dashes have to
be at the beginning of the line
to make them detected as a signature.

opw-655834
production/rebase-20171130
Denis Ledoux 8 years ago
parent d179a94da6
commit 31e8bb8e9d

@ -140,7 +140,7 @@ def html_email_clean(html):
node.getparent().remove(node)
# 4. strip signatures
signature = re.compile(r'([-]{2}[\s]?[\r\n]{1,2}[^\z]+)')
signature = re.compile(r'(^[-]{2,}[\s]?[\r\n]{1,2}[\s\S]+)', re.M)
for elem in root.getiterator():
if elem.text:
match = re.search(signature, elem.text)

Loading…
Cancel
Save