diff --git a/README.md b/README.md index 52e74f77..7856a345 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ Mailbox object is with the following structure * **root** (boolean) `true` if the node is root * **name** (string) unicode decoded name of the mailbox * **path** (string) full path to the mailbox - * **delimiter** (string) path delimiting symbol + * **delimiter** (string) path delimiting symbol. In the event the server returns NIL for this (some servers do this for the INBOX), it will be coerced to a '/' at this time, but the behavior may be changed in the future depending on how the folder creation API is implemented. * **listed** (boolean) mailbox was found in the LIST response * **subscribed** (boolean) mailbox was found in the LSUB response * **specialUse** (string) mailbox was identified as a special use mailbox ('\Trash', '\Sent', '\Junk' etc. see [RFC6154](http://tools.ietf.org/html/rfc6154#section-2)) @@ -247,7 +247,7 @@ Namespace object is with the following structure Namespace element object has the following structure * **prefix** is the prefix string - * **delimiter** is the hierarchy delimiter + * **delimiter** is the hierarchy delimiter. This can be null for some servers but will usually be a string. **NB!** Namespace_Response_Extensions are not supported (extension data is silently skipped) diff --git a/src/browserbox.js b/src/browserbox.js index e90a7237..38ea1f6a 100644 --- a/src/browserbox.js +++ b/src/browserbox.js @@ -1196,7 +1196,8 @@ return !arr ? false : [].concat(arr || []).map(function(ns) { return !ns || !ns.length ? false : { prefix: ns[0].value, - delimiter: ns[1].value + // The delimiter can legally be NIL which maps to null + delimiter: ns[1] && ns[1].value }; }); }; diff --git a/test/unit/browserbox-test.js b/test/unit/browserbox-test.js index 3c1b7c1c..14664cdb 100644 --- a/test/unit/browserbox-test.js +++ b/test/unit/browserbox-test.js @@ -1194,7 +1194,25 @@ delimiter: '/' }] }); + }); + it('should handle NIL namespace hierarchy delim', function() { + expect(br._parseNAMESPACE({ + payload: { + NAMESPACE: [ + // This specific value is returned by yahoo.co.jp's + // imapgate version 0.7.68_11_1.61475 IMAP server + imapHandler.parser('* NAMESPACE (("" NIL)) NIL NIL') + ] + } + })).to.deep.equal({ + personal: [{ + prefix: '', + delimiter: null + }], + users: false, + shared: false + }); }); });