Skip to content

Fix resolve_relative_url to handle multi-level relative paths#267

Open
voidpetal wants to merge 1 commit into
aboutcode-org:mainfrom
voidpetal:resolve-relative-url
Open

Fix resolve_relative_url to handle multi-level relative paths#267
voidpetal wants to merge 1 commit into
aboutcode-org:mainfrom
voidpetal:resolve-relative-url

Conversation

@voidpetal
Copy link
Copy Markdown

resolve_relative_url only handled one level of ../ traversal. When a PyPI simple index returns hrefs with multiple ../ segments (e.g. ../../packages/...), the function left literal ../ in the final URL, causing 404 errors on servers that don't normalize paths server-side.
Replace the manual string manipulation with urllib.parse.urljoin, which correctly resolves arbitrary ../ depth.

@voidpetal voidpetal force-pushed the resolve-relative-url branch from 4e7f273 to 60187c1 Compare June 1, 2026 10:19
Signed-off-by: Kai Hodžić <hodzic.e.k@outlook.com>
@voidpetal voidpetal force-pushed the resolve-relative-url branch from 60187c1 to c240fe3 Compare June 1, 2026 10:27
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