diff --git a/backend/bookslm.py b/backend/bookslm.py index d7c5fc6..145d428 100644 --- a/backend/bookslm.py +++ b/backend/bookslm.py @@ -43,9 +43,7 @@ def _should_skip(name: str) -> bool: skip_names = {"_attachments", "node_modules", ".git", ".obsidian", "__pycache__"} if name in skip_names: return True - if any(name.startswith(p) for p in skip_prefixes): - return True - return False + return bool(any(name.startswith(p) for p in skip_prefixes)) def _file_priority(path: Path) -> tuple[int, float]: @@ -252,12 +250,7 @@ def invalidate_cache(vault_path: Path | None = None, directory: str | None = Non _cache.clear() return count - to_remove = [] - for key, val in _cache.items(): - # We can't easily reverse the hash, so clear everything if vault_path is given - # For targeted invalidation, callers should use directory - to_remove.append(key) - + to_remove = list(_cache) for k in to_remove: del _cache[k] return len(to_remove) diff --git a/backend/export.py b/backend/export.py index 39d12fa..2bf396e 100644 --- a/backend/export.py +++ b/backend/export.py @@ -356,7 +356,7 @@ def export_epub(vault_path: Path, file_path: Path) -> bytes: rendered = _render_body(body, path.parent, vault_path, path) - uid = f"obsigate-{_slugify(title)}-{int(datetime.datetime.now().timestamp())}" + uid = f"obsigate-{_slugify(title)}-{int(datetime.datetime.now(tz=datetime.timezone.utc).timestamp())}" xhtml = f""" diff --git a/backend/watcher.py b/backend/watcher.py index a840be6..a6a55ee 100644 --- a/backend/watcher.py +++ b/backend/watcher.py @@ -39,10 +39,9 @@ def find_mount_fstype(resolved_path: str, mount_lines: Iterable[str]) -> str: # /proc/mounts escapes special chars in octal mount_point = mount_point.replace("\\040", " ").replace("\\011", "\t") root = mount_point.rstrip("/") or "/" - if resolved_path == root or resolved_path.startswith(root + "/"): - if len(mount_point) > len(best_point): - best_point = mount_point - best_fstype = fstype + if (resolved_path == root or resolved_path.startswith(root + "/")) and len(mount_point) > len(best_point): + best_point = mount_point + best_fstype = fstype return best_fstype