aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Volchkov <yuri.volchkov@gmail.com>2018-06-20 14:21:42 +0200
committerStephen Finucane <stephen@that.guru>2018-06-20 15:41:03 +0100
commite27ff061dc01e51967a978884a5c59152863ab9c (patch)
tree6f8a393a4c5c2d50f73b78e2682df6a924959f64
parent60152d32680e6b16a6c1b4b330ad7500172f0f2d (diff)
downloadpatchwork-e27ff061dc01e51967a978884a5c59152863ab9c.tar
patchwork-e27ff061dc01e51967a978884a5c59152863ab9c.tar.gz
parsemail: ignore html part of multi-part comments
Currently an html-protection present only for patch-emails. If a multi-part comment-email arrives, it messes up patchwork. In my case, the symptom was a non intended 'Signed-off-by' in the downloaded patches, with html-like junk. This patch makes parsemail skip all parts of comment which are not text/plain. Of course, this will drop html-only emails completely. But they can not be parsed anyways. Signed-off-by: Yuri Volchkov <yuri.volchkov@gmail.com> Reviewed-by: Stephen Finucane <stephen@that.guru>
-rw-r--r--patchwork/parser.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/patchwork/parser.py b/patchwork/parser.py
index 8f9af81..a40f931 100644
--- a/patchwork/parser.py
+++ b/patchwork/parser.py
@@ -576,10 +576,13 @@ def find_comment_content(mail):
"""Extract content from a mail."""
commentbuf = ''
- for payload, _ in _find_content(mail):
+ for payload, subtype in _find_content(mail):
if not payload:
continue
+ if subtype != 'plain':
+ continue
+
commentbuf += payload.strip() + '\n'
commentbuf = clean_content(commentbuf)