Ignore any unicode_escape decode fails when decoding emails (Fixes #122).

This is only needed with emails that have escape characters, as described
in issue #46. If the call fails, it will most likely not affect us and
can be safely ignored.
This commit is contained in:
Adam Waldenberg 2017-05-13 16:41:54 +02:00
parent b3fbb3e3c3
commit c80c822892

View file

@ -279,8 +279,11 @@ class Changes(object):
def get_latest_author_by_email(self, name):
if not hasattr(name, "decode"):
name = str.encode(name)
try:
name = name.decode("unicode_escape", "ignore")
except UnicodeEncodeError:
pass
name = name.decode("unicode_escape", "ignore")
return self.authors_by_email[name]
def get_latest_email_by_author(self, name):