Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use file(1) for detecting ALZ archives #174

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
5 changes: 1 addition & 4 deletions patoolib/mime.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,6 @@ def guess_mime_file(filename: str) -> tuple[str | None, str | None]:
@return: tuple (mime, encoding)
"""
mime, encoding = None, None
base, ext = os.path.splitext(filename)
if ext.lower() in ('.alz',):
# let mimedb recognize these extensions
return mime, encoding
if os.path.isfile(filename):
file_prog = find_program("file")
if file_prog:
Expand Down Expand Up @@ -246,6 +242,7 @@ def get_file_mime_encoding(parts: Sequence[str]) -> str | None:
FileText2Mime: dict[str, str] = {
"7-zip archive data": "application/x-7z-compressed",
"ACE archive data": "application/x-ace",
"ALZ archive data": "application/x-alzip",
"Amiga DOS disk": "application/x-adf",
"ARJ archive data": "application/x-arj",
"bzip2 compressed data": "application/x-bzip2",
Expand Down
5 changes: 2 additions & 3 deletions tests/test_mime.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,8 @@ def test_mime_file(self):
self.mime_test_file("t.lha", "application/x-lha")
self.mime_test_file("t.lzh", "application/x-lha")
self.mime_test_file("t.lha.foo", "application/x-lha")
# file(1) does not recognize .alz files
# self.mime_test_file("t.alz", "application/x-alzip")
# self.mime_test_file("t.alz.foo", "application/x-alzip")
self.mime_test_file("t.alz", "application/x-alzip")
self.mime_test_file("t.alz.foo", "application/x-alzip")
self.mime_test_file("t.arc", "application/x-arc")
self.mime_test_file("t.arc.foo", "application/x-arc")
self.mime_test_file("t.txt.lz4", "application/x-lz4")
Expand Down
Loading