emailjs / emailjs-imap-client

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

Invalid SEARCH response should return undefined instead of an #259

Closed ltgorm closed 2 years ago

ltgorm commented 2 years ago

empty list. Empty list should mean that nothing was found.

According to my research, the SEARCH array in the response will always be an array of length 1 or higher. For a search that returns no messages it is the "attributes" attribute of objects in the SEARCH array that will contain the values. And if nothing was found then the "attributes" attribute is missing.

It is bad for our client (Vivaldi) to receive an empty list as a, seemingly, valid response because that means that we mark all the message as having been removed from the server. They become internal messages and only visible in the Trash view.

nifgraup commented 2 years ago

Rather throw than returning undefined. That's what happens on other errors.