mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-19 09:30:15 +00:00
[fix]: Raise Value Error when no password is provided
This commit is contained in:
parent
7fe753436e
commit
b17017696c
@ -995,8 +995,11 @@ class PyMuPDFParser(BaseBlobParser):
|
||||
doc = pymupdf.open(file_path)
|
||||
else:
|
||||
doc = pymupdf.open(stream=file_path, filetype="pdf")
|
||||
if doc.is_encrypted and self.password is None:
|
||||
raise ValueError("Password is required to open encrypted PDFs.")
|
||||
if doc.is_encrypted:
|
||||
doc.authenticate(self.password)
|
||||
|
||||
doc_metadata = {
|
||||
"producer": "PyMuPDF",
|
||||
"creator": "PyMuPDF",
|
||||
|
Loading…
Reference in New Issue
Block a user