ignore UnicodeDecodeError when parsing SpamAssassin response

This commit is contained in:
Son NK 2020-09-30 12:00:05 +02:00
parent c8e92af4d3
commit 8ed619687f

View file

@ -74,7 +74,9 @@ class SpamAssassin(object):
logging.error(first_line) logging.error(first_line)
return None return None
report_list = [s.strip() for s in body.decode("utf-8").strip().split("\n")] report_list = [
s.strip() for s in body.decode("utf-8", errors="ignore").strip().split("\n")
]
linebreak_num = report_list.index([s for s in report_list if "---" in s][0]) linebreak_num = report_list.index([s for s in report_list if "---" in s][0])
tablelists = [s for s in report_list[linebreak_num + 1 :]] tablelists = [s for s in report_list[linebreak_num + 1 :]]