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 AI review feedback and gitleaks failures

LearningCircuita08e5c93612e
diff --git a/.gitleaks.toml b/.gitleaks.toml
index c0862b10e2..cd78fac008 100644
--- a/.gitleaks.toml
+++ b/.gitleaks.toml
@@ -81,7 +81,9 @@ paths = [
'''.*test.*\.py$''',
'''.*example.*\.py$''',
'''mock.*\.py$''',
- '''fixture.*\.py$'''
+ '''fixture.*\.py$''',
+ # Exclude CI/CD workflow files that contain test credentials
+ '''.github/workflows/.*\.yml$'''
]
files = [
"\\.env\\.example$",
diff --git a/src/local_deep_research/research_library/downloaders/openalex.py b/src/local_deep_research/research_library/downloaders/openalex.py
index b70ec7edb3..e884186e30 100644
--- a/src/local_deep_research/research_library/downloaders/openalex.py
+++ b/src/local_deep_research/research_library/downloaders/openalex.py
@@ -8,6 +8,8 @@ OpenAlex aggregates open access information from multiple sources.
import re
from typing import Optional
from urllib.parse import urlparse
+
+import requests
from loguru import logger
from .base import BaseDownloader, ContentType, DownloadResult
@@ -41,7 +43,7 @@ class OpenAlexDownloader(BaseDownloader):
or hostname.endswith(".openalex.org")
)
)
- except Exception:
+ except (ValueError, AttributeError, TypeError):
return False
def download(
@@ -166,8 +168,29 @@ class OpenAlexDownloader(BaseDownloader):
logger.info(
f"Found landing page for work {work_id}: {landing_url}"
)
- # Try to download from landing page (might be a direct PDF)
- return landing_url
+ # Validate that landing page is actually a PDF before returning
+ try:
+ head_response = self.session.head(
+ landing_url,
+ timeout=self.timeout,
+ allow_redirects=True,
+ )
+ content_type = head_response.headers.get(
+ "Content-Type", ""
+ ).lower()
+ if "application/pdf" in content_type:
+ logger.info(
+ f"Landing page is a direct PDF link for work {work_id}"
+ )
+ return landing_url
+ else:
+ logger.info(
+ f"Landing page is not a PDF (Content-Type: {content_type}), skipping"
+ )
+ except Exception:
+ logger.exception(
+ f"Failed to validate landing page URL for work {work_id}"
+ )
logger.info(
f"No PDF URL available for open access work {work_id}"
@@ -181,6 +204,11 @@ class OpenAlexDownloader(BaseDownloader):
logger.warning(f"OpenAlex API error: {response.status_code}")
return None
- except Exception:
+ except (
+ requests.exceptions.RequestException,
+ ValueError,
+ KeyError,
+ TypeError,
+ ):
logger.exception("Failed to query OpenAlex API")
return None
diff --git a/src/local_deep_research/research_library/downloaders/semantic_scholar.py b/src/local_deep_research/research_library/downloaders/semantic_scholar.py
index a3aa00144d..f32231717c 100644
--- a/src/local_deep_research/research_library/downloaders/semantic_scholar.py
+++ b/src/local_deep_research/research_library/downloaders/semantic_scholar.py
@@ -7,6 +7,8 @@ Downloads PDFs from Semantic Scholar using their API to find open access PDFs.
import re
from typing import Optional
from urllib.parse import urlparse
+
+import requests
from loguru import logger
from .base import BaseDownloader, ContentType, DownloadResult
@@ -38,7 +40,7 @@ class SemanticScholarDownloader(BaseDownloader):
or hostname.endswith(".semanticscholar.org")
)
)
- except Exception:
+ except (ValueError, AttributeError, TypeError):
return False
def download(
@@ -164,6 +166,11 @@ class SemanticScholarDownloader(BaseDownloader):
)
return None
- except Exception:
+ except (
+ requests.exceptions.RequestException,
+ ValueError,
+ KeyError,
+ TypeError,
+ ):
logger.exception("Failed to query Semantic Scholar API")
return None