fix: skip unreadable PDFs during metadata extraction
This commit is contained in:
@@ -155,7 +155,11 @@ class PdfExtractor(FileExtractor):
|
||||
if isinstance(data, UploadFile):
|
||||
data = data.file
|
||||
|
||||
doc = pypdfium2.PdfDocument(data)
|
||||
try:
|
||||
doc = pypdfium2.PdfDocument(data)
|
||||
except Exception as e:
|
||||
logger.error(f"Error extracting metadata from pdf: {e}")
|
||||
return {}
|
||||
|
||||
basic_metadata = doc.get_metadata_dict(skip_empty=False)
|
||||
metadata["title"] = basic_metadata["Title"]
|
||||
|
||||
Reference in New Issue
Block a user