List Files through get, because query cannot see a folder before 0.16

Creating a folder on the live 0.15.5 server did nothing visible, with no error
and nothing after a reload. The folder was real all along: FileNode/query masks
its results with document_ids(false) — resources that are *not* containers — so
it returns files and never folders, and says nothing about the omission.

FileNode/get carries no such mask, so on those servers the whole tree comes
from a single get with ids:null instead. That also stops ensureFolder making a
fresh "ihasmail" folder on every signature save, having never been able to find
the one already there.
This commit is contained in:
2026-08-24 10:05:08 -07:00
parent 5befef7ed7
commit 8d90bca6b4
4 changed files with 73 additions and 28 deletions
+19 -1
View File
@@ -1,6 +1,6 @@
import { afterEach, describe, expect, it } from "vitest";
import { client } from "@/jmap/client";
import { directoryCreate, fileCreate, fileNodeProps, supportsNodeType, normalizeFileNodes } from "../filenode";
import { directoryCreate, fileCreate, fileNodeProps, normalizeFileNodes, queryOmitsDirectories, supportsNodeType } from "../filenode";
import type { FileNode, JmapSession } from "@/jmap/types";
/**
@@ -117,3 +117,21 @@ describe("rights on a pre-0.16 server", () => {
expect(node!.nodeType).toBe("directory");
});
});
/**
* Before 0.16, FileNode/query masks its results with `document_ids(false)` —
* only resources that are *not* containers. It therefore returns files and
* never folders, with no error to explain the omission: a folder created there
* exists but never comes back in a listing. FileNode/get carries no such mask.
*/
describe("directory-blind query", () => {
it("is worked around on older servers", () => {
client.session = session(OLD_SERVER);
expect(queryOmitsDirectories()).toBe(true);
});
it("is not worked around where query can see folders", () => {
client.session = session(NEW_SERVER);
expect(queryOmitsDirectories()).toBe(false);
});
});