Fix list_vault leaking .git/objects into results
rglob walks into .git/ before the name-check on .git itself fires. Files under .git/objects/ have normal names so the entry-level filter didn't stop them. Added ancestor-path check that skips any entry with a hidden (dot-prefixed) directory anywhere in its path. The result was a 566K-char blob that blew past the model's 32K context.
This commit is contained in:
parent
31a288933f
commit
c1cb15cb3b
1 changed files with 9 additions and 0 deletions
|
|
@ -201,6 +201,15 @@ def list_vault(
|
||||||
continue
|
continue
|
||||||
if entry.name in OBSIDIAN_HIDDEN and not str(entry.resolve()).startswith(str(vault / ".obsidian")):
|
if entry.name in OBSIDIAN_HIDDEN and not str(entry.resolve()).startswith(str(vault / ".obsidian")):
|
||||||
continue
|
continue
|
||||||
|
# Also skip entries nested inside any hidden/excluded directory ancestor
|
||||||
|
# (e.g. .git/objects/ab/cdef — the file name looks innocent but it lives
|
||||||
|
# under .git, which rglob walks into before we can stop it)
|
||||||
|
rel = entry.relative_to(vault)
|
||||||
|
if any(
|
||||||
|
part.startswith(".") and part != ".obsidian"
|
||||||
|
for part in rel.parts
|
||||||
|
):
|
||||||
|
continue
|
||||||
|
|
||||||
info = _file_info(entry, vault)
|
info = _file_info(entry, vault)
|
||||||
if entry.is_dir():
|
if entry.is_dir():
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue