Skip to content
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
5675e97
Image reader and image support in `gather_evidence` (#1046)
jamesbraza Aug 6, 2025
d1cde22
Preventing Greek name from crashing `DocDetails` creation (#1048)
jamesbraza Aug 6, 2025
0caa926
Better invalid name logs (#1049)
jamesbraza Aug 6, 2025
f71d023
Multimodal PDF support (#1047)
jamesbraza Aug 7, 2025
d3760c9
Fix paperqa/configs link in README.md (#1051)
chrisranderson Aug 8, 2025
948423f
Fixing all broken links, `pymarkdown` (#1052)
jamesbraza Aug 9, 2025
d34543e
Documenting `DocMetadataTask`/`MetadataProvider` (#1050)
jamesbraza Aug 9, 2025
beb838e
chore(deps): lock file maintenance (#1053)
renovate[bot] Aug 9, 2025
81ea858
chore(deps): update actions/checkout action to v5 (#1058)
renovate[bot] Aug 11, 2025
193feb6
chore(deps): update actions/download-artifact action to v5 (#1059)
renovate[bot] Aug 11, 2025
72b7f26
Moved `mypy` to use `local` hook to unsilence it on missing dependenc…
jamesbraza Aug 11, 2025
6801155
Removed dead `patch` from `test_add_clinical_trials_to_docs` (#1056)
jamesbraza Aug 11, 2025
34ceb70
Restored `UnpaywallProvider` by updating expected response (#1057)
jamesbraza Aug 11, 2025
fab944a
Refreshed `test_crossref_journalquality_fields_filtering` cassette (#…
jamesbraza Aug 11, 2025
4862764
Updating `journal_quality.csv` from script (#1061)
jamesbraza Aug 11, 2025
2d58202
Better lookup failure message in `Settings.from_name` (#1064)
jamesbraza Aug 16, 2025
62afb8c
Lower bibtex logging to debug (#1067)
mskarlin Aug 19, 2025
687ce40
Fix: handle non-UTF-8 input in util.py
dmcgrath19 Aug 20, 2025
7a88d42
Add comments to utf-8 error handling
dmcgrath19 Aug 20, 2025
46e21d6
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Aug 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix: handle non-UTF-8 input in util.py
Chemistry papers such as DOIs 10.26434/chemrxiv-2025-1x058-v2 and 10.26434/chemrxiv-2025-3lwn2 contain files that sometimes throw errors due to non-UTF-8 characters during parsing. This change updates the MD5 hashing line to replace problematic characters during UTF-8 encoding, making the parsing process more robust and preventing interruptions caused by encoding errors.
  • Loading branch information
dmcgrath19 authored Aug 20, 2025
commit 687ce4023a4b7ba2a69a3f8e7611645fca6e1305
2 changes: 1 addition & 1 deletion src/paperqa/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def strings_similarity(s1: str, s2: str, case_insensitive: bool = True) -> float

def hexdigest(data: str | bytes) -> str:
if isinstance(data, str):
return hashlib.md5(data.encode("utf-8")).hexdigest() # noqa: S324
return hashlib.md5(data.encode("utf-8", errors="replace")).hexdigest() # noqa: S324
Copy link

Copilot AI Aug 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'replace' error handling may silently mask data corruption issues. Consider logging when characters are replaced or using 'ignore' if replacement characters could affect hash consistency. This change could cause different hash values for the same logical content depending on encoding issues.

Suggested change
return hashlib.md5(data.encode("utf-8", errors="replace")).hexdigest() # noqa: S324
return hashlib.md5(data.encode("utf-8", errors="strict")).hexdigest() # noqa: S324

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a code comment above this stating why we have replace over strict or ignore?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sure thing!

return hashlib.md5(data).hexdigest() # noqa: S324


Expand Down