fix: odysseus-mail read crashes on an empty IMAP fetch payload (#1730)

This commit is contained in:
Afonso Coutinho
2026-06-03 05:31:10 +01:00
committed by GitHub
parent c5bc39de88
commit d9e6071528
2 changed files with 64 additions and 1 deletions

View File

@@ -190,7 +190,7 @@ def cmd_read(args) -> None:
if st != "OK":
fail(f"select {args.folder!r} failed: {st}")
st, msg_data = conn.fetch(args.uid.encode(), "(BODY.PEEK[])")
if st != "OK":
if st != "OK" or not msg_data or not msg_data[0]:
fail(f"fetch UID {args.uid} failed: {st}")
raw = msg_data[0][1]
msg = email_mod.message_from_bytes(raw)