Fix IMAP emails appearing empty: accept bytearray from aioimaplib literals

aioimaplib stores RFC822 literal data as bytearray in response.lines,
not bytes. The extraction loop checked isinstance(line, bytes) which
returns False for bytearray, silently dropping every email body and
causing all IMAP emails (T-Online, GMX, etc.) to appear empty.

Fix: accept (bytes, bytearray) and convert to bytes() immediately so
the rest of the pipeline is unaffected. Two new regression tests mirror
the real aioimaplib behaviour by passing bytearray as the literal.

Agent-Logs-Url: https://github.com/christianlouis/InboxConverge/sessions/341f5c82-70f8-438d-91ca-8e906a06c400

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-28 22:08:04 +00:00
parent fd2adb08cd
commit da05016143
4 changed files with 83 additions and 2 deletions
+8
View File
@@ -27,6 +27,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `.safety-policy.yml` to document and suppress the two unfixable `ecdsa` side-channel CVEs (64396, 64459) that the upstream maintainers have acknowledged cannot be resolved in pure Python.
### Fixed
- **IMAP: fix all IMAP emails appearing empty** — `aioimaplib` stores RFC822
literal data as `bytearray`, not `bytes`. The FETCH extraction loop was
checking `isinstance(line, bytes)` which returns `False` for `bytearray`,
causing every email body to be silently skipped and the message to appear
empty. The check now accepts both types (`isinstance(line, (bytes,
bytearray))`) and converts the result to plain `bytes` before returning,
so the rest of the pipeline is unaffected. This affected every IMAP
account (T-Online, GMX, and others).
- **IMAP: fix T-Online BYE "Too many invalid IMAP commands"** — `UID STORE` flag
arguments now use RFC 3501required parentheses: `+FLAGS (\Seen)` and
`+FLAGS (\Deleted)`. Strict servers such as T-Online reject the bare