You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
imapclient/search: handle UID SEARCH results without hits
When searching for unseen mails we can get the following error if there
are none.
> in response-data: imapwire: expected SP, got "\r"
The reason is that the IMAP server is sending a response like this in
case there are no search hits.
T7 UID SEARCH RETURN (ALL) (UNSEEN)
* ESEARCH (TAG "T7") UID T7 OK SEARCH completed (Success)
The wire protocol parser is expecting a search option (like "ALL") to be
present in any search result. As we can see above, this is not the case
if there are no results, which results in the parser hitting a CRLF when
it expected a space.
To account for this we peek into the reply of the server to see whether
there is a CRLF after the "UID" atom. If there is, we assume there were
no results and return an empty result.
0 commit comments