From 8b41b38769c07cbad8376a17462679444f00423e Mon Sep 17 00:00:00 2001 From: jfx21 <81051927+jfx21@users.noreply.github.com> Date: Wed, 19 Aug 2026 19:08:22 +0200 Subject: [PATCH] fix: Issue with overleaf pdf files --- src/guarddoc/scanners/archive.py | 8 +++----- src/guarddoc/scanners/office.py | 7 +++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/guarddoc/scanners/archive.py b/src/guarddoc/scanners/archive.py index 4e74aa9..2485ccf 100644 --- a/src/guarddoc/scanners/archive.py +++ b/src/guarddoc/scanners/archive.py @@ -56,13 +56,11 @@ class ArchiveScanner(BaseScanner): def name(self) -> str: return "ArchiveScanner" - def is_supported(self, file_path: Path, mime_type: str) -> bool: + def is_supported(self, file_path: Path, mime_type: str | None) -> bool: ext = file_path.suffix.lower() + mime = (mime_type or "").lower() return ( - ext in self.ARCHIVE_EXTENSIONS - or "zip" in mime_type - or "tar" in mime_type - or "compressed" in mime_type + ext in self.ARCHIVE_EXTENSIONS or "zip" in mime or "tar" in mime or "compressed" in mime ) def scan( diff --git a/src/guarddoc/scanners/office.py b/src/guarddoc/scanners/office.py index a2280c1..bf1fedc 100644 --- a/src/guarddoc/scanners/office.py +++ b/src/guarddoc/scanners/office.py @@ -26,12 +26,11 @@ class OfficeScanner(BaseScanner): ".pptm", } - def is_supported(self, file_path: Path, mime_type: str = "unknown") -> bool: + def is_supported(self, file_path: Path, mime_type: str | None) -> bool: """Check if file extension or MIME type matches Microsoft Office documents.""" ext = file_path.suffix.lower() - return ( - ext in self.OFFICE_EXTENSIONS or "officedocument" in mime_type or "msword" in mime_type - ) + mime = (mime_type or "").lower() + return ext in self.OFFICE_EXTENSIONS or "officedocument" in mime or "msword" in mime def scan( self,