closeio / sync-engine

GNU Affero General Public License v3.0
26 stars 9 forks source link

Cannot `SELECT` folders with tabs in their name `\t` on `outlook.office365.com` #964

Open neob91-close opened 1 week ago

neob91-close commented 1 week ago

It looks like Microsoft Outlook (IMAP connection to outlook.office365.com) does not adhere to the IMAP spec and returns a BAD Command Argument Error. 11 when attempting to select a folder containing the tab character (ASCII 0x09). Sync-engine is not at fault here, but maybe there is something we can do to mitigate this issue?

This is an example client<->server exchange:

...
C: A010 SELECT "INBOX/ &AAk-Example "
S: A010 BAD Command Argument Error. 11

What's interesting is that Microsoft returns the folder name with the tab character unencoded. See a Python repr of a partial response to the LIST command:

b'* LIST (\\HasNoChildren) "/" "INBOX/ \tExample "\r\n'

Yet sending the tab unencoded in the SELECT command also results in BAD Command Argument Error. 11.