From a4af814665bb2a0ffaaa0a1878a1ec77b7c1376e Mon Sep 17 00:00:00 2001 From: Frank Colson Date: Sat, 3 Aug 2024 12:02:35 -0700 Subject: [PATCH] Fix file path resolution from load_document --- docprompt/utils/util.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docprompt/utils/util.py b/docprompt/utils/util.py index 9d0c5e6..5386d34 100644 --- a/docprompt/utils/util.py +++ b/docprompt/utils/util.py @@ -92,9 +92,10 @@ def load_pdf_document( if isinstance(fp, bytes): file_bytes = fp file_name = file_name or determine_pdf_name_from_bytes(file_bytes) + file_path = None else: file_name = name_from_path(fp) if file_name is None else file_name - + file_path = str(fp) file_bytes = read_pdf_bytes_from_path(fp) if not is_pdf(file_bytes): @@ -102,7 +103,7 @@ def load_pdf_document( return PdfDocument( name=unquote(file_name), - file_path=str(fp), + file_path=file_path, file_bytes=file_bytes, password=password, )