Skip to content

Commit 4b446db

Browse files
Fix apache bug flag for on _APACHE_TYPES (#14)
1 parent fa67530 commit 4b446db

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

tests/test_main.py

+9
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ class TestMain:
7373
(b"", (b"text/html; charset=utf-8",), True, False, None, None, b"text/html"),
7474
(b"", (b"text/htmlpdfthing",), True, False, None, None, b"text/htmlpdfthing"),
7575
(b"", None, True, False, None, None, b"text/plain"),
76+
(
77+
b"\x00\x01\xff",
78+
(b"text/plain; charset=windows-1252",),
79+
True,
80+
False,
81+
None,
82+
None,
83+
b"text/plain",
84+
),
7685
(
7786
b"test",
7887
None,

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ commands =
3434
[testenv:typing]
3535
basepython = python3
3636
deps =
37-
mypy==0.780
37+
mypy==0.910
3838
commands =
3939
mypy --show-error-codes --ignore-missing-imports \
4040
--follow-imports=skip {posargs: xtractmime setup.py tests}

xtractmime/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ def extract_mime(
198198
) -> Optional[bytes]:
199199
extra_types = extra_types or tuple()
200200
supplied_type = content_types[-1] if content_types else b""
201-
supplied_type = supplied_type.split(b";")[0].strip().lower()
202201
check_for_apache = http_origin and supplied_type in _APACHE_TYPES
202+
supplied_type = supplied_type.split(b";")[0].strip().lower()
203203
resource_header = memoryview(body)[:RESOURCE_HEADER_BUFFER_LENGTH]
204204

205205
if supplied_type in (b"", b"unknown/unknown", b"application/unknown", b"*/*"):

0 commit comments

Comments
 (0)