Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/guarddoc/scanners/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 3 additions & 4 deletions src/guarddoc/scanners/office.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading