Closed titanism closed 2 months ago
If part is undefined and if response.bodyParts is a Map such as the following:
part
undefined
response.bodyParts
Map
response { seq: 1, uid: 1, size: 50000196, bodyParts: Map(1) { ']<0.65536>' => <Buffer 44 61 74 65 3a 20 32 30 32 34 2d 30 36 2d 32 34 54 30 39 3a 30 33 3a 35 30 2e 38 35 33 5a 0d 0a 54 6f 3a 20 66 6f 6f 2d 31 40 65 78 61 6d 70 6c 65 2d ... 50000146 more bytes> }, modseq: 2n, id: '5538720b5b4805e674b821b303ac7797' }
Then the download returned value will be {} since chunk is false.
download
{}
chunk
Example usage:
const data = await imapFlow.download(1); // note that `part` and `options` are optional
Source code where bug can be found:
https://github.com/postalsys/imapflow/blob/954a9ded083edf638d90356a1ea38f28c69ac4ce/lib/imap-flow.js#L2529-L2532
This was a bug on my side (IMAP was not sending over the exact requested size/chunks)
If
part
isundefined
and ifresponse.bodyParts
is aMap
such as the following:Then the
download
returned value will be{}
sincechunk
is false.Example usage:
Source code where bug can be found:
https://github.com/postalsys/imapflow/blob/954a9ded083edf638d90356a1ea38f28c69ac4ce/lib/imap-flow.js#L2529-L2532