Preserve valid files beside unsupported Legacy CLI names

This commit is contained in:
vorotamoroz committed 2026-11-05 08:36:39 +00:00
1 parent bf2241e5ee
commit 165944fe65
2 files changed
+13 -2

No files matched your search

@@ -251,9 +251,9 @@ export class NodeFileSystemAdapter implements IFileSystemAdapter<NodeFile, NodeF
const entries = await this.storage.list(relativePath, false); const entries = await this.storage.list(relativePath, false);
for (const entryPath of entries.files) { for (const entryPath of entries.files) {
const filePath = parseFilePath(entryPath); const stat = await this.storage.stat(entryPath, false);
const stat = await this.storage.stat(filePath, false);
if (stat?.type !== "file") continue; if (stat?.type !== "file") continue;
const filePath = parseFilePath(entryPath);
const file: NodeFile = { const file: NodeFile = {
path: filePath, path: filePath,
stat, stat,
@@ -51,6 +51,17 @@ describe("NodeFileSystemAdapter file enumeration", () => {
expect((await adapter.getFiles()).map((file) => file.path).sort()).toEqual(paths); expect((await adapter.getFiles()).map((file) => file.path).sort()).toEqual(paths);
}); });
it.skipIf(process.platform === "win32")(
"compatibility: lists other files in Legacy mode when one root name is unsupported",
async () => {
const { directory, adapter } = await createVault();
await fs.writeFile(path.join(directory, "a:unrelated.md"), "unrelated local bytes");
expect((await adapter.getFiles()).map((file) => file.path).sort()).toEqual(paths);
expect(await fs.readFile(path.join(directory, "a:unrelated.md"), "utf8")).toBe("unrelated local bytes");
}
);
it("excludes a deleted file after its cache entry is refreshed", async () => { it("excludes a deleted file after its cache entry is refreshed", async () => {
const { directory, adapter } = await createVault(); const { directory, adapter } = await createVault();
await adapter.getFiles(); await adapter.getFiles();