diff options
author | Mark Sapiro <mark@msapiro.net> | 2013-10-07 21:57:09 -0700 |
---|---|---|
committer | Mark Sapiro <mark@msapiro.net> | 2013-10-07 21:57:09 -0700 |
commit | 68073e8b93147371bc020afd3b41d5e173574044 (patch) | |
tree | c3a3c2cfcad183fc2f42ad0671274cd6c6706415 /Mailman/Handlers | |
parent | d7b0aff13ec27bf1b1476b7771affab62788e6ea (diff) | |
download | mailman2-68073e8b93147371bc020afd3b41d5e173574044.tar.gz mailman2-68073e8b93147371bc020afd3b41d5e173574044.tar.xz mailman2-68073e8b93147371bc020afd3b41d5e173574044.zip |
- Fixed a crash in SpamDetect.py which caused messages with unparseable
RFC 2047 encoded headers to be shunted. (LP: #1235101)
Diffstat (limited to 'Mailman/Handlers')
-rw-r--r-- | Mailman/Handlers/SpamDetect.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Mailman/Handlers/SpamDetect.py b/Mailman/Handlers/SpamDetect.py index 8d26da03..9e01f623 100644 --- a/Mailman/Handlers/SpamDetect.py +++ b/Mailman/Handlers/SpamDetect.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2012 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2013 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -27,6 +27,7 @@ TBD: This needs to be made more configurable and robust. import re +from email.Errors import HeaderParseError from email.Header import decode_header from Mailman import mm_cfg @@ -68,7 +69,10 @@ def getDecodedHeaders(msg, cset='utf-8'): headers = '' for h, v in msg.items(): uvalue = u'' - v = decode_header(re.sub('\n\s', ' ', v)) + try: + v = decode_header(re.sub('\n\s', ' ', v)) + except HeaderParseError: + v = [(v, 'us-ascii')] for frag, cs in v: if not cs: cs = 'us-ascii' |