Skip to content

Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.

Normalize PDF suffix handling for AI files to be case-insensitive

myhloli907099762f84
diff --git a/mineru/cli/common.py b/mineru/cli/common.py
index ae89de3d..0214c20f 100644
--- a/mineru/cli/common.py
+++ b/mineru/cli/common.py
@@ -27,7 +27,7 @@ def read_fn(path):
with open(str(path), "rb") as input_file:
file_bytes = input_file.read()
file_suffix = guess_suffix_by_bytes(file_bytes)
- if file_suffix in ["ai"] and path.suffix in [".pdf"]:
+ if file_suffix in ["ai"] and path.suffix.lower() in [".pdf"]:
file_suffix = "pdf"
if file_suffix in image_suffixes:
return images_bytes_to_pdf_bytes(file_bytes)
diff --git a/mineru/utils/guess_suffix_or_lang.py b/mineru/utils/guess_suffix_or_lang.py
index 887aa190..ae2cc6cb 100644
--- a/mineru/utils/guess_suffix_or_lang.py
+++ b/mineru/utils/guess_suffix_or_lang.py
@@ -21,6 +21,6 @@ def guess_suffix_by_path(file_path) -> str:
if not isinstance(file_path, Path):
file_path = Path(file_path)
suffix = magika.identify_path(file_path).prediction.output.label
- if suffix in ["ai"] and file_path.suffix in [".pdf"]:
+ if suffix in ["ai"] and file_path.suffix.lower() in [".pdf"]:
suffix = "pdf"
return suffix
\ No newline at end of file