Skip to content

Commit dde6ddb

Browse files
committed
Try to make sure the email is parsed
This patch tries to do some sanity checks on decoding an email envelope.
1 parent f19a36f commit dde6ddb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

aprsd_email_plugin/aprsd_email_plugin.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,9 +671,16 @@ def loop(self):
671671

672672
for msgid, data in _msgs.items():
673673
envelope = data[b"ENVELOPE"]
674+
if not envelope:
675+
LOG.error(f"Failed fetching email ENVELOPE")
676+
continue
677+
678+
subject = "Empty"
679+
if envelope.subject:
680+
subject = envelope.subject.decode()
674681
LOG.debug(
675682
'ID:%d "%s" (%s)'
676-
% (msgid, envelope.subject.decode(), envelope.date),
683+
% (msgid, subject, envelope.date),
677684
)
678685
f = re.search(
679686
r"'([[A-a][0-9]_-]+@[[A-a][0-9]_-\.]+)",

0 commit comments

Comments
 (0)