fix: use file extension if filetype fails with PDF (#827)

Filetype library may not identify some files as PDF. Leverage the file extension
as a simple solution.

Signed-off-by: Cesar Berrospi Ramis <75900930+ceberam@users.noreply.github.com>
This commit is contained in:
Cesar Berrospi Ramis 2025-01-28 19:03:54 +01:00 committed by GitHub
parent ba521dd88f
commit adf6353483
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -352,6 +352,8 @@ class _DocumentConversionInput(BaseModel):
mime = FormatToMimeType[InputFormat.MD][0]
elif ext in FormatToExtensions[InputFormat.JSON_DOCLING]:
mime = FormatToMimeType[InputFormat.JSON_DOCLING][0]
elif ext in FormatToExtensions[InputFormat.PDF]:
mime = FormatToMimeType[InputFormat.PDF][0]
return mime
@staticmethod