force convert contact_from_header to string

This commit is contained in:
Son NK 2020-04-05 15:42:09 +02:00
parent 2619333cc6
commit f3244eb274
1 changed files with 2 additions and 0 deletions

View File

@ -106,6 +106,8 @@ def get_or_create_contact(contact_from_header: str, alias: Alias) -> Contact:
"""
contact_from_header is the RFC 2047 format FROM header
"""
# force convert header to string, sometimes contact_from_header is Header object
contact_from_header = str(contact_from_header)
contact_name, contact_email = parseaddr_unicode(contact_from_header)
contact = Contact.get_by(alias_id=alias.id, website_email=contact_email)
if contact: