diff --git a/MailKit/Net/Imap/ImapUtils.cs b/MailKit/Net/Imap/ImapUtils.cs index d1be879449..0f347490cc 100644 --- a/MailKit/Net/Imap/ImapUtils.cs +++ b/MailKit/Net/Imap/ImapUtils.cs @@ -467,10 +467,10 @@ static string ReadFolderName (ImapEngine engine, char delim, string format, Canc case ImapTokenType.Atom: encodedName = (string) token.Value; - // Note: Exchange apparently doesn't quote folder names that contain tabs. + // Note: Exchange (Office365 and potentially 2016/2019/other versions) has a bug where it doesn't quote folder names that contain CTRL characters (including tab). // // See https://github.com/jstedfast/MailKit/issues/945 for details. - if (engine.QuirksMode == ImapQuirksMode.Exchange) { + if (token.Type == ImapTokenType.Atom && engine.QuirksMode == ImapQuirksMode.Exchange) { var line = engine.ReadLine (cancellationToken); // unget the \r\n sequence @@ -502,10 +502,10 @@ static async Task ReadFolderNameAsync (ImapEngine engine, char delim, st case ImapTokenType.Atom: encodedName = (string) token.Value; - // Note: Exchange apparently doesn't quote folder names that contain tabs. + // Note: Exchange (Office365 and potentially 2016/2019/other versions) has a bug where it doesn't quote folder names that contain CTRL characters (including tab). // // See https://github.com/jstedfast/MailKit/issues/945 for details. - if (engine.QuirksMode == ImapQuirksMode.Exchange) { + if (token.Type == ImapTokenType.Atom && engine.QuirksMode == ImapQuirksMode.Exchange) { var line = await engine.ReadLineAsync (cancellationToken).ConfigureAwait (false); // unget the \r\n sequence