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: Address security vulnerabilities and date formatting issues

LearningCircuitb90cc8930a5e
diff --git a/src/local_deep_research/text_optimization/citation_formatter.py b/src/local_deep_research/text_optimization/citation_formatter.py
index c6d7db97fc..626284971d 100644
--- a/src/local_deep_research/text_optimization/citation_formatter.py
+++ b/src/local_deep_research/text_optimization/citation_formatter.py
@@ -365,10 +365,13 @@ class QuartoExporter:
title = title_match.group(1) if title_match else "Research Report"
# Create Quarto YAML header
+ from datetime import datetime
+
+ current_date = datetime.now().strftime("%Y-%m-%d")
yaml_header = f"""---
title: "{title}"
author: "Local Deep Research"
-date: today
+date: "{current_date}"
format:
html:
toc: true
@@ -549,17 +552,21 @@ class RISExporter:
if domain.startswith("www."):
domain = domain[4:]
# Extract readable publisher name from domain
- if "github.com" in domain:
+ if domain == "github.com" or domain.endswith(".github.com"):
lines.append("PB - GitHub")
- elif "arxiv.org" in domain:
+ elif domain == "arxiv.org" or domain.endswith(".arxiv.org"):
lines.append("PB - arXiv")
- elif "reddit.com" in domain:
+ elif domain == "reddit.com" or domain.endswith(".reddit.com"):
lines.append("PB - Reddit")
- elif "youtube.com" in domain or "m.youtube.com" in domain:
+ elif (
+ domain == "youtube.com"
+ or domain == "m.youtube.com"
+ or domain.endswith(".youtube.com")
+ ):
lines.append("PB - YouTube")
- elif "medium.com" in domain:
+ elif domain == "medium.com" or domain.endswith(".medium.com"):
lines.append("PB - Medium")
- elif "pypi.org" in domain:
+ elif domain == "pypi.org" or domain.endswith(".pypi.org"):
lines.append("PB - Python Package Index (PyPI)")
else:
# Use domain as publisher
diff --git a/src/local_deep_research/text_optimization/test_citation_formatter.py b/src/local_deep_research/text_optimization/test_citation_formatter.py
index bf31970f01..3376c45243 100644
--- a/src/local_deep_research/text_optimization/test_citation_formatter.py
+++ b/src/local_deep_research/text_optimization/test_citation_formatter.py
@@ -1,6 +1,10 @@
"""Test script to demonstrate citation formatter functionality."""
-from citation_formatter import CitationFormatter, CitationMode, LaTeXExporter
+from local_deep_research.text_optimization.citation_formatter import (
+ CitationFormatter,
+ CitationMode,
+ LaTeXExporter,
+)
def test_citation_formatter():
@@ -51,7 +55,11 @@ The analysis reveals several important points:
"[[2]](https://www.nature.com/articles/s41586-021-03819-2)" in formatted
)
assert "[[3]](https://openai.com/research/emergent-abilities)" in formatted
- assert "[[1]][[2]][[3]]" in formatted # Check multiple citations together
+ # Check that consecutive citations are each hyperlinked
+ assert (
+ "[[1]](https://arxiv.org/abs/2104.12345)[[2]](https://www.nature.com/articles/s41586-021-03819-2)[[3]](https://openai.com/research/emergent-abilities)"
+ in formatted
+ )
print("✓ NUMBER_HYPERLINKS mode assertions passed")
# Test DOMAIN_HYPERLINKS mode
@@ -108,7 +116,7 @@ The analysis reveals several important points:
assert "\\date{\\today}" in latex_content
assert "\\begin{document}" in latex_content
assert "\\end{document}" in latex_content
- assert "\\section{Key Findings}" in latex_content
+ assert "\\subsection{Key Findings}" in latex_content
assert "\\bibitem{ref1}" in latex_content
assert "\\cite{ref1}" in latex_content
print("✓ LaTeX export assertions passed")
diff --git a/src/local_deep_research/web/routes/research_routes.py b/src/local_deep_research/web/routes/research_routes.py
index 7833412008..d4b629b74c 100644
--- a/src/local_deep_research/web/routes/research_routes.py
+++ b/src/local_deep_research/web/routes/research_routes.py
@@ -783,7 +783,9 @@ def export_research_report(research_id, format):
except Exception as e:
logger.exception(f"Error exporting report: {str(e)}")
return jsonify(
- {"error": f"Failed to export to {format}: {str(e)}"}
+ {
+ "error": f"Failed to export to {format}. Please try again later."
+ }
), 500
finally: