feat: fix hidden files whitelist logic to require ALL hidden path components be whitelisted, add vault config to single file indexing, and improve reindex button feedback with save phase indication

This commit is contained in:
2026-03-26 14:14:04 -04:00
parent 08e4d732f5
commit 80e2a7fc53
3 changed files with 23 additions and 11 deletions
+11 -3
View File
@@ -444,13 +444,14 @@ def _get_async_lock() -> asyncio.Lock:
return _async_index_lock
def _index_single_file_sync(vault_name: str, vault_path: str, file_path: str) -> Optional[Dict[str, Any]]:
def _index_single_file_sync(vault_name: str, vault_path: str, file_path: str, vault_cfg: Optional[Dict[str, Any]] = None) -> Optional[Dict[str, Any]]:
"""Synchronously read and parse a single file for indexing.
Args:
vault_name: Name of the vault.
vault_path: Absolute path to vault root.
file_path: Absolute path to the file.
vault_cfg: Optional vault configuration dict with hidden files settings.
Returns:
File info dict or None if the file cannot be read.
@@ -464,7 +465,11 @@ def _index_single_file_sync(vault_name: str, vault_path: str, file_path: str) ->
relative = fpath.relative_to(vault_root)
rel_parts = relative.parts
if any(part.startswith(".") for part in rel_parts):
# Check if path should be included based on hidden files configuration
if vault_cfg is None:
vault_cfg = {"includeHidden": False, "hiddenWhitelist": []}
if not should_include_path(rel_parts, vault_cfg):
return None
ext = fpath.suffix.lower()
@@ -614,8 +619,11 @@ async def update_single_file(vault_name: str, abs_file_path: str) -> Optional[Di
if not vault_path:
return None
# Get vault configuration for hidden files handling
vault_cfg = vault_data.get("config") or vault_config.get(vault_name, {})
loop = asyncio.get_event_loop()
file_info = await loop.run_in_executor(None, _index_single_file_sync, vault_name, vault_path, abs_file_path)
file_info = await loop.run_in_executor(None, _index_single_file_sync, vault_name, vault_path, abs_file_path, vault_cfg)
lock = _get_async_lock()
async with lock: