emailjs / emailjs-imap-client

Low-level JS IMAP client for all your IMAP needs.
MIT License
557 stars 123 forks source link

Server response not properly parsed into lines when literal has zero length #147

Closed rickhall closed 6 years ago

rickhall commented 7 years ago

I originally posted this as an issue here: emailjs/emailjs-imap-handler#20

To summarize, for a query like this:

t uid fetch 585599 (body.peek[1.1] body.peek[1.2])

If the result is something like this:

* 126015 FETCH (UID 585599 BODY[1.2] {0}
 BODY[1.1] {0}
)
t OK Success

Then Imap.prototype._iterateIncomingBuffer() gets confused and does not properly look for additional literals since the only way this can happen is if control goes into the "if (diff)" conditional, but it can't since diff will always be zero.

rickhall commented 7 years ago

I opened an issue and then created a pull request. Not sure if that is the correct approach or if I should have only created the pull request.

nifgraup commented 6 years ago

Fixed with cb477365e9eea57f2d6588ec827b93fe2fff7b03.