Skip to content

Escape package names in pypi/cargo/cocoapods/deno API URLs#16

Merged
andrew merged 1 commit intomainfrom
escape-package-names
Apr 13, 2026
Merged

Escape package names in pypi/cargo/cocoapods/deno API URLs#16
andrew merged 1 commit intomainfrom
escape-package-names

Conversation

@andrew
Copy link
Copy Markdown
Contributor

@andrew andrew commented Apr 8, 2026

npm uses url.PathEscape on package names before building API URLs. These four don't. A package name like requests?evil=1 becomes https://pypi.org/pypi/requests?evil=1/json where ? starts a query string, the path truncates to /pypi/requests, and /json gets eaten by the fragment after #.

Practical impact is low since the worst case is querying a different package than the manifest named, and Go's client normalizes ../ already. But npm got it right and these should match.

Same pattern exists in hex, homebrew, luarocks, nimble, haxelib. Mechanical sweep for those if wanted.

@andrew andrew merged commit 2cdaa8e into main Apr 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant