The tuple is not bytes, so the body in tuple[1] is discarded and the client receives only the trailing b")". RETR is therefore broken against any real IMAP server.
The existing unit test passes only because DummyIMAP returns a flat list of bytes, which imaplib never produces.
Fix:
Extract the body from the tuple element (tuple[1]) of the FETCH response.
Update the test fixture to return the realistic tuple shape so the bug cannot regress.
Acceptance:
RETR returns the full message body against a tuple-shaped FETCH response.
Test fixture reflects real imaplib output.
IMAPBackend.fetch_message (proxy_server.py:119) filters the imaplib FETCH response to top-level bytes only:
parts = [chunk for chunk in data if isinstance(chunk, bytes)]
Real imaplib returns the RFC822 literal inside a tuple, e.g.
[(b"1 (UID 1 RFC822 {N}", b"<raw message bytes>"), b")"]
The tuple is not `bytes`, so the body in tuple[1] is discarded and the client receives only the trailing b")". RETR is therefore broken against any real IMAP server.
The existing unit test passes only because DummyIMAP returns a flat list of bytes, which imaplib never produces.
Fix:
- Extract the body from the tuple element (tuple[1]) of the FETCH response.
- Update the test fixture to return the realistic tuple shape so the bug cannot regress.
Acceptance:
- RETR returns the full message body against a tuple-shaped FETCH response.
- Test fixture reflects real imaplib output.
lyrathorpe
added the bug label 2026-06-17 17:12:00 +01:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
IMAPBackend.fetch_message (proxy_server.py:119) filters the imaplib FETCH response to top-level bytes only:
Real imaplib returns the RFC822 literal inside a tuple, e.g.
The tuple is not
bytes, so the body in tuple[1] is discarded and the client receives only the trailing b")". RETR is therefore broken against any real IMAP server.The existing unit test passes only because DummyIMAP returns a flat list of bytes, which imaplib never produces.
Fix:
Acceptance: