From c1a8fedebd36e16be7e7bb255bf8ea5387f02d5d Mon Sep 17 00:00:00 2001 From: Alex Drummond Date: Fri, 2 Sep 2011 03:58:21 +0100 Subject: [PATCH 1/2] Exchange doesn't always quote mailbox names -- make quotes optional in regex. --- imap.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imap.js b/imap.js index aab6afd..67dc0ea 100644 --- a/imap.js +++ b/imap.js @@ -337,7 +337,7 @@ ImapConnection.prototype.connect = function(loginCb) { else if (self.delim !== null) { if (self._state.requests[0].args.length === 0) self._state.requests[0].args.push({}); - result = /^\((.*)\) (.+?) "(.+)"$/.exec(data[2]); + result = /^\((.*)\) (.+?) "?(.+)"?$/.exec(data[2]); var box = { attribs: result[1].split(' ').map(function(attrib) { return attrib.substr(1).toUpperCase(); @@ -1561,4 +1561,4 @@ function pipe(pair, socket) { socket.on('close', onclose); return cleartext; -} \ No newline at end of file +} From 164afe0bc4fe9e0d10662fbc3fe6d6fd172055c0 Mon Sep 17 00:00:00 2001 From: Alex Drummond Date: Fri, 2 Sep 2011 04:00:59 +0100 Subject: [PATCH 2/2] Modify another regex where quotes may not always be present. --- imap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imap.js b/imap.js index 67dc0ea..0c27928 100644 --- a/imap.js +++ b/imap.js @@ -331,7 +331,7 @@ ImapConnection.prototype.connect = function(loginCb) { case 'LIST': var result; if (self.delim === null - && (result = /^\(\\No[sS]elect\) (.+?) ".*"$/.exec(data[2]))) + && (result = /^\(\\No[sS]elect\) (.+?) .*$/.exec(data[2]))) self.delim = (result[1] === 'NIL' ? false : result[1].substring(1, result[1].length-1)); else if (self.delim !== null) {