From 5f0930b2912c11b5e7825794d19bc10ee3779292 Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Sun, 31 Jan 2021 11:50:41 +0100 Subject: [PATCH] handle header is None in get_header_unicode --- app/email_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/email_utils.py b/app/email_utils.py index a7f4c0ea..ff722a54 100644 --- a/app/email_utils.py +++ b/app/email_utils.py @@ -613,7 +613,10 @@ def get_spam_from_header(spam_status_header, max_score=None) -> (bool, str): return spamassassin_answer.lower() == "yes", spam_status_header -def get_header_unicode(header: str): +def get_header_unicode(header: str) -> str: + if header is None: + return "" + decoded_string, charset = decode_header(header)[0] if charset is not None: try: