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.

fix: correct PathValidator usage for PDF downloads

LearningCircuit08378d17aa84
diff --git a/src/local_deep_research/research_library/services/download_service.py b/src/local_deep_research/research_library/services/download_service.py
index eb1e46bb49..e5909f7943 100644
--- a/src/local_deep_research/research_library/services/download_service.py
+++ b/src/local_deep_research/research_library/services/download_service.py
@@ -505,18 +505,23 @@ class DownloadService:
pdf_path = Path(self.library_root) / "pdfs"
pdf_path.mkdir(parents=True, exist_ok=True)
- # Save file with unique name using PathValidator for security
- file_path = pdf_path / filename
-
- # Validate the path is safe and within library root
+ # Use PathValidator with relative path from library_root
+ # Pass the relative path "pdfs/filename" for validation
+ relative_path = f"pdfs/{filename}"
validated_path = PathValidator.validate_safe_path(
- str(file_path), base_dir=str(self.library_root), must_exist=False
+ relative_path,
+ base_dir=str(self.library_root),
+ required_extensions=(".pdf",),
)
+ if not validated_path:
+ raise ValueError(f"Invalid file path: {filename}")
+
+ # Write the PDF file
with open(validated_path, "wb") as f:
f.write(content)
- return validated_path
+ return str(validated_path)
def _download_generic(self, url: str) -> Optional[bytes]:
"""Generic PDF download method."""