email_mirror: Filter out null characters in email bodies.

They're rarely useful, usually displayed invisibly in most tools
anyway, and this helps make sure the message makes it into Zulip
rather than being rejected.
This commit is contained in:
Tim Abbott
2017-10-03 15:05:46 -07:00
parent 167c3570f8
commit 069f681bc6

View File

@@ -148,6 +148,8 @@ def mark_missed_message_address_as_used(address):
def construct_zulip_body(message, realm): def construct_zulip_body(message, realm):
# type: (message.Message, Realm) -> Text # type: (message.Message, Realm) -> Text
body = extract_body(message) body = extract_body(message)
# Remove null characters, since Zulip will reject
body = body.replace("\x00", "")
body = filter_footer(body) body = filter_footer(body)
body += extract_and_upload_attachments(message, realm) body += extract_and_upload_attachments(message, realm)
if not body: if not body: