mirror of
https://github.com/aaronsb/obsidian-mcp-plugin.git
synced 2026-07-22 06:45:14 +00:00
vault.list(directory) returned an empty array whenever the target folder's direct children were all subfolders — listFiles used folder.children and then filtered to TFile, dropping every descendant. Meanwhile the root case used vault.getAllLoadedFiles() which is recursive, so root and directory listings diverged. listFiles now walks the folder tree when a directory is provided, matching the recursive semantics of the root case. Callers that were already iterating result paths get the same shape — full vault-rooted paths to .md files — they just no longer hit the empty-list cliff for folder-of-folders inputs. The synchronous throw on missing directory is preserved; existing try/catch sites at router.ts:538 and :1030 use it as a "does this exist as a directory" probe. Adds tests/list-files-recursive.test.ts with regression coverage: - recursing through a folder of subfolders returns all descendant files - recurses through arbitrary nesting depth - still throws on a missing directory - root call (no directory) still returns the full vault Test fixtures: tests/__mocks__/obsidian.ts gained a TFolder class and a stat field on TFile. Closes #154. |
||
|---|---|---|
| .. | ||
| obsidian.ts | ||