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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Fixed

- Fixed content-type header parsing to handle PyPI mirrors that include charset parameters.
This improves compatibility with mirrors that return headers like `application/json; charset=utf-8`.
[#261](https://github.com/pyodide/micropip/pull/261)

## [0.11.0] - 2025/10/18

### Added
Expand Down
10 changes: 4 additions & 6 deletions micropip/package_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,16 +250,14 @@ def _select_parser(
"""
Select the function to parse the response based on the content type.
"""
match content_type:
main_content_type = content_type.split(";")[0].strip()

match main_content_type:
case "application/vnd.pypi.simple.v1+json":
return ProjectInfo.from_simple_json_api
case "application/json":
return ProjectInfo.from_json_api
case (
"application/vnd.pypi.simple.v1+html"
| "text/html"
| "text/html; charset=utf-8"
):
case "application/vnd.pypi.simple.v1+html" | "text/html":
return partial(
ProjectInfo.from_simple_html_api,
pkgname=pkgname,
Expand Down