Skip to content

Commit 31b6582

Browse files
committed
fix: make content-type checking more flexible for PyPI mirrors
1 parent f2e9b51 commit 31b6582

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

micropip/package_index.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,16 +250,14 @@ def _select_parser(
250250
"""
251251
Select the function to parse the response based on the content type.
252252
"""
253-
match content_type:
253+
main_content_type = content_type.split(';')[0].strip()
254+
255+
match main_content_type:
254256
case "application/vnd.pypi.simple.v1+json":
255257
return ProjectInfo.from_simple_json_api
256258
case "application/json":
257259
return ProjectInfo.from_json_api
258-
case (
259-
"application/vnd.pypi.simple.v1+html"
260-
| "text/html"
261-
| "text/html; charset=utf-8"
262-
):
260+
case "application/vnd.pypi.simple.v1+html" | "text/html":
263261
return partial(
264262
ProjectInfo.from_simple_html_api,
265263
pkgname=pkgname,

0 commit comments

Comments
 (0)