Skip to content

Commit

Permalink
fix: make sure subject is a string
Browse files Browse the repository at this point in the history
  • Loading branch information
firstof9 committed Oct 6, 2023
1 parent 1c0a552 commit 762bec8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions custom_components/mail_and_packages/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1378,6 +1378,11 @@ def get_items(
)
else:
email_subject = decode_header(msg["subject"])[0][0]

if not isinstance(email_subject, str):
_LOGGER.debug("Converting subject to string.")
email_subject = email_subject.decode('utf-8','ignore')

_LOGGER.debug("Amazon Subject: %s", str(email_subject))
pattern = re.compile(r"[0-9]{3}-[0-9]{7}-[0-9]{7}")

Expand Down

0 comments on commit 762bec8

Please sign in to comment.