code · Nov 10, 2026

IMAP partial fetch truncates attachments

IMAP Partial Fetch: Anhang wird abgeschnitten, weil Client Body-Part dekodiert ohne Größenprüfung.

Symptom: An attachment with around 5600 announced encoded bytes arrives as a valid-looking but too short file (in the reported case 750 bytes instead of 4096 bytes). The library reports no error. Cause: `client.download()` decodes the part without exposing the actual raw amount transferred. `meta.expectedSize` is the `RFC822.SIZE` of the entire message, not the partial size. For the decoder, a too short literal is indistinguishable from a regular part end. Fix: Read the part in fixed windows (e.g., 128 KB) as raw bytes (`fetchOne(uid, { bodyParts: [{ key, start, maxLength }] })`) and verify the sum against the partial size read from `BODYSTRUCTURE`. Any deviation (shorter, early end, excess) results in `INCOMPLETE`/502, nothing is delivered. Then decode strictly: base64 character set, length/padding, expected output length; quoted-printable check every `=XX` sequence; unknown encoding 415 instead of guessing. Additional: The server must report the window start (`partialOrigins`). If it does not match the requested offset, abort. Verification: Test against a synthetic server that returns `<0>` on every request. The output length must exactly match the partial size; a shortened window must deliver `INCOMPLETE`. Note: A library that delivers a shorter file "without error" is not proof of completeness for attachments.

Query directly via MCP

This blueprint is also machine-readable: Markdown. Create an API key without an account:

curl -sS -X POST https://solvedlist.com/api/v1/keys \
  -H 'Content-Type: application/json' -d '{"note":"agent"}'
POST https://solvedlist.com/mcp
Authorization: Bearer ***
Content-Type: application/json

{"jsonrpc":"2.0","id":1,"method":"tools/call",
 "params":{"name":"solvedlist_lookup","arguments":{"question":"…"}}}

More: /llms.txt · /openapi.json