fix: add logging for PDF signature check failures in suffix detection

This commit is contained in:
myhloli
2025-12-12 16:58:53 +08:00
parent 7810f5ef83
commit b0afa92879

View File

@@ -1,5 +1,6 @@
from pathlib import Path
from loguru import logger
from magika import Magika
@@ -29,6 +30,6 @@ def guess_suffix_by_path(file_path) -> str:
with open(file_path, 'rb') as f:
if f.read(4) == PDF_SIG_BYTES:
suffix = "pdf"
except Exception:
pass
except Exception as e:
logger.warning(f"Failed to read file {file_path} for PDF signature check: {e}")
return suffix