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: sanitize exception messages in download service API responses

LearningCircuit0f4d9e6018f6
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 0c963d51cc..76b5537f2d 100644
--- a/src/local_deep_research/research_library/services/download_service.py
+++ b/src/local_deep_research/research_library/services/download_service.py
@@ -27,6 +27,7 @@ from ...database.models.download_tracker import (
DownloadAttempt,
DownloadTracker,
)
+from ...security import redact_data
from ...database.models.library import (
LibraryDocument,
LibraryDownloadQueue,
@@ -546,7 +547,9 @@ class DownloadService:
attempt.error_type = type(e).__name__
attempt.error_message = str(e)
tracker.is_accessible = False
- return False, str(e)
+ # Sanitize error message before returning to API
+ safe_error = redact_data(str(e))
+ return False, safe_error
def _save_pdf(self, resource: ResearchResource, content: bytes) -> str:
"""
@@ -954,7 +957,9 @@ class DownloadService:
return True, None
except Exception as e:
logger.exception(f"Failed to save text for resource {resource.id}")
- return False, f"Failed to save text: {str(e)}"
+ # Sanitize error message before returning to API
+ safe_error = redact_data(f"Failed to save text: {str(e)}")
+ return False, safe_error
def _fallback_pdf_extraction(
self, session, resource, save_files: bool
@@ -1018,7 +1023,9 @@ class DownloadService:
return True, None
except Exception as e:
logger.exception(f"Failed to save text for resource {resource.id}")
- return False, f"Failed to save text: {str(e)}"
+ # Sanitize error message before returning to API
+ safe_error = redact_data(f"Failed to save text: {str(e)}")
+ return False, safe_error
def _get_downloader(self, url: str):
"""