Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

refactor: remove fallback in is_relative_to check per djpetti review

LearningCircuitf41057b52fda
diff --git a/src/local_deep_research/security/path_validator.py b/src/local_deep_research/security/path_validator.py
index 05bb1d37e5..bfa6109766 100644
--- a/src/local_deep_research/security/path_validator.py
+++ b/src/local_deep_research/security/path_validator.py
@@ -161,18 +161,7 @@ class PathValidator:
# Check against restricted directories
for restricted in restricted_dirs:
- is_restricted = False
- try:
- is_restricted = validated_path.is_relative_to(restricted)
- except (ValueError, AttributeError):
- # Fallback for older Python or path comparison issues
- path_str = str(validated_path)
- restricted_str = str(restricted)
- is_restricted = path_str.startswith(
- restricted_str + "/"
- ) or path_str.startswith(restricted_str + "\\")
-
- if is_restricted:
+ if validated_path.is_relative_to(restricted):
logger.error(
f"Security: Blocked access to restricted directory: {validated_path}"
)