imapkit 5.3.1 → 5.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -819,7 +819,11 @@ class IMAPServer extends node_stream_1.Stream {
819
819
  const levels = mailbox.path.split(storage.separator);
820
820
  const folderName = levels.pop();
821
821
  const parentKey = levels.join(storage.separator);
822
- const parent = (parentKey !== 'INBOX' && this.folderCache[parentKey]) || storage;
822
+ // A child of INBOX lives in INBOX's own folders, unless the personal namespace is "INBOX." itself, where its
823
+ // mailboxes are the namespace's
824
+ const inboxParent = parentKey.toUpperCase() === 'INBOX';
825
+ const holdsNamespace = namespace === this.referenceNamespace && this.inboxHoldsNamespace();
826
+ const parent = ((!inboxParent || !holdsNamespace) && this.folderCache[parentKey]) || storage;
823
827
  if (mailbox.folders && Object.keys(mailbox.folders).length && !keepContents) {
824
828
  // Sessions that have the mailbox selected keep the old object, a new SELECT finds the
825
829
  // placeholder. The placeholder only keeps the children. Plugin data (MAILBOXID, special-use, metadata, ACL,
@@ -778,7 +778,11 @@ class IMAPServer extends Stream {
778
778
  const levels = mailbox.path.split(storage.separator);
779
779
  const folderName = levels.pop();
780
780
  const parentKey = levels.join(storage.separator);
781
- const parent = (parentKey !== 'INBOX' && this.folderCache[parentKey]) || storage;
781
+ // A child of INBOX lives in INBOX's own folders, unless the personal namespace is "INBOX." itself, where its
782
+ // mailboxes are the namespace's
783
+ const inboxParent = parentKey.toUpperCase() === 'INBOX';
784
+ const holdsNamespace = namespace === this.referenceNamespace && this.inboxHoldsNamespace();
785
+ const parent = ((!inboxParent || !holdsNamespace) && this.folderCache[parentKey]) || storage;
782
786
  if (mailbox.folders && Object.keys(mailbox.folders).length && !keepContents) {
783
787
  // Sessions that have the mailbox selected keep the old object, a new SELECT finds the
784
788
  // placeholder. The placeholder only keeps the children. Plugin data (MAILBOXID, special-use, metadata, ACL,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imapkit",
3
- "version": "5.3.1",
3
+ "version": "5.3.2",
4
4
  "description": "Scriptable, strictly RFC compliant in-memory IMAP server for testing IMAP clients",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",