Permalink
Browse files

Relax mailbox name regex

  • Loading branch information...
1 parent 5c9343d commit 5ba46387346d345ca191d692feb604d99086aabf @mscdex committed Apr 12, 2012
Showing with 11 additions and 11 deletions.
  1. +11 −11 imap.js
View
22 imap.js
@@ -346,18 +346,18 @@ 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();
- })/*.filter(function(attrib) {
- return (BOX_ATTRIBS.indexOf(attrib) > -1);
- })*/,
- delim: (result[2] === 'NIL'
- ? false : result[2].substring(1, result[2].length-1)),
- children: null,
- parent: null
- }, name = result[3], curChildren = self._state.requests[0].args[0];
+ attribs: result[1].split(' ').map(function(attrib) {
+ return attrib.substr(1).toUpperCase();
+ }),
+ delim: (result[2] === 'NIL'
+ ? false : result[2].substring(1, result[2].length-1)),
+ children: null,
+ parent: null
+ }, name = result[3], curChildren = self._state.requests[0].args[0];
+ if (name[0] === '"' && name[name.length-1] === '"')
+ name = name.substring(1, name.length - 1);
if (box.delim) {
var path = name.split(box.delim).filter(isNotEmpty),

0 comments on commit 5ba4638

Please sign in to comment.