mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-20 01:49:51 +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)
|
doc = pymupdf.open(file_path)
|
||||||
else:
|
else:
|
||||||
doc = pymupdf.open(stream=file_path, filetype="pdf")
|
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:
|
if doc.is_encrypted:
|
||||||
doc.authenticate(self.password)
|
doc.authenticate(self.password)
|
||||||
|
|
||||||
doc_metadata = {
|
doc_metadata = {
|
||||||
"producer": "PyMuPDF",
|
"producer": "PyMuPDF",
|
||||||
"creator": "PyMuPDF",
|
"creator": "PyMuPDF",
|
||||||
|
Loading…
Reference in New Issue
Block a user