From f0911f51a056ee325360ea77550458b4f6ff5007 Mon Sep 17 00:00:00 2001 From: Jessica McKellar Date: Tue, 24 Sep 2013 10:05:26 -0400 Subject: [PATCH] email mirror: ignore decoding errors. Empirically, we only get these for malformed emails where the charset specified in a message part header does not match the true encoding of the part. I checked what the resulting Zulip looked like for the original offender, and it looked find with ignoring errors. (imported from commit ac6ba65b611cb22d4ec547b75a585abce6fc50b0) --- zerver/management/commands/email-mirror.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zerver/management/commands/email-mirror.py b/zerver/management/commands/email-mirror.py index 70da883873..64eb9e4840 100755 --- a/zerver/management/commands/email-mirror.py +++ b/zerver/management/commands/email-mirror.py @@ -137,7 +137,7 @@ def get_message_part_by_type(message, content_type): if part.get_content_type() == content_type: content = part.get_payload(decode=True) if charsets[idx]: - content = content.decode(charsets[idx]) + content = content.decode(charsets[idx], errors="ignore") return content def extract_body(message):