micropip icon indicating copy to clipboard operation
micropip copied to clipboard

Simple HTML repository relative URLs are broken

Open juntyr opened this issue 8 months ago • 1 comments

#150 (cc @Carreau) introduced support for relative index URLs. Unfortunately, the transformation from relative to absolute is broken:

https://github.com/pyodide/micropip/blob/d0d2e7ab4974b121964843143d5a2df9b6182a0a/micropip/package_index.py#L327

For an index at e.g. /main/pypa/simple/ and a package URL /main/pypa/simple/numpy/, the relative wheel file URL is made absolute to /, not to /main/pypa/simple/numpy/. This goes against HTML redirects and thus seems to go against the spec, which states (for the simple JSON spec which builds on the HTML spec) "If relative, they are relative to the current URL as if it were HTML."

Is there a specific index that relies on this broken redirect?

I will propose a PR to fix this.

juntyr avatar Apr 06 '25 08:04 juntyr

if a repo rely on this, it's either pypi, or pypi.anaconda.org.

Carreau avatar Apr 06 '25 09:04 Carreau