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

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 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_name, contact_email = parseaddr_unicode(contact_from_header)
contact = Contact.get_by(alias_id=alias.id, website_email=contact_email) contact = Contact.get_by(alias_id=alias.id, website_email=contact_email)
if contact: if contact: