Skip to content

[codex] Fix IMAP fetch when BODY precedes UID#112

Draft
mpscholten wants to merge 1 commit into
qnikst:masterfrom
mpscholten:codex/issue-96-fetch-body-before-uid
Draft

[codex] Fix IMAP fetch when BODY precedes UID#112
mpscholten wants to merge 1 commit into
qnikst:masterfrom
mpscholten:codex/issue-96-fetch-body-before-uid

Conversation

@mpscholten

Copy link
Copy Markdown
Contributor

Summary

Fix IMAP.fetch returning an empty ByteString when a UID FETCH response contains BODY[] before the server-supplied UID item.

The previous lookup' implementation assumed parsed fetch keys needed their first two words dropped, which only worked for the older parser artifact where keys looked like UID <n> BODY[]. When the response key is simply BODY[], the lookup misses and fetch falls back to BS.empty.

This change normalizes fetch keys before comparison, preserving compatibility with the UID <n> prefix form while also matching direct BODY[] keys, BODY.PEEK[], and origin suffixes such as BODY[]<0>.

Tests

  • nix shell nixpkgs#haskell.compiler.ghc948 nixpkgs#cabal-install --command cabal test imap-parsers --test-show-details=direct

@mpscholten mpscholten force-pushed the codex/issue-96-fetch-body-before-uid branch from 4c9e838 to c84ec9e Compare June 12, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant