Unverified Commit 891b75af authored by Isis Lovecruft's avatar Isis Lovecruft
Browse files

Fix a bug where incoming unicode emails caused logging errors.

The stupid Python stdlib logging module doesn't handle unicode at
all. If debugging is turned on, and SAFELOGGING is disabled, the
incoming emails are logged. If they have any unicode characters,
processing of the emails stops due to UnicodeDecodeErrors.
parent bb948f9e
......@@ -174,7 +174,13 @@ class SMTPMessage(object):
else:
self.lines.append(line)
if not safelog.safe_logging:
logging.debug("> %s", line.rstrip("\r\n"))
try:
logging.debug("> %s", line.rstrip("\r\n"))
except UnicodeError: # pragma: no cover
pass
except Exception as error: # pragma: no cover
logging.error("Error while trying to log incoming email")
logging.exception(error)
def eomReceived(self):
"""Tell the :ivar:`responder` to reply when we receive an EOM."""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment