Skip to content

Commit 93a7eee

Browse files
author
Gerit Wagner
committed
unpaywall: remove pdf upon pymupdf.FileDataError
1 parent 8361824 commit 93a7eee

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

colrev/packages/unpaywall/src/unpaywall.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,11 @@ def _unpaywall(
8383
return best_loc["url_for_pdf"]
8484

8585
def _is_pdf(self, *, path_to_file: Path) -> bool:
86-
with pymupdf.open(path_to_file) as doc:
87-
doc.load_page(0).get_text()
86+
try:
87+
with pymupdf.open(path_to_file) as doc:
88+
doc.load_page(0).get_text()
89+
except pymupdf.FileDataError:
90+
return False
8891
return True
8992

9093
def get_pdf(

0 commit comments

Comments
 (0)