Skip to content

Commit

Permalink
fix: make sure subject is a string (#854)
Browse files Browse the repository at this point in the history
* fix: make sure subject is a string

* formatting
  • Loading branch information
firstof9 authored Oct 6, 2023
1 parent 1c0a552 commit acbb0d9
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 acbb0d9

Please sign in to comment.