fix(email): don't try to parse flags that seem to be invalid

Sometimes we get invalid flags from `imap.uid()`, like `[b'System Error (Failure)']`

This leads to the flag getting parsed as 83 (`ord('S')`)

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2024-12-17 16:04:05 +05:30
parent d0c314090c
commit d285dd5cbf
No known key found for this signature in database
GPG key ID: 9DCC61E211BF645F

View file

@ -283,7 +283,7 @@ class EmailServer:
def get_email_seen_status(self, uid, flag_string):
"""parse the email FLAGS response"""
if not flag_string:
if not flag_string or not isinstance(flag_string, str | bytes):
return None
flags = []