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,