From c1cb15cb3b73dd2a7f01bbccdc0262279211fd6e Mon Sep 17 00:00:00 2001 From: helm Date: Tue, 7 Jul 2026 01:43:08 -0400 Subject: [PATCH] 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. --- server.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server.py b/server.py index 2d05b28..5c2f00a 100644 --- a/server.py +++ b/server.py @@ -201,6 +201,15 @@ def list_vault( continue if entry.name in OBSIDIAN_HIDDEN and not str(entry.resolve()).startswith(str(vault / ".obsidian")): 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) if entry.is_dir():