Skip to content

fix(uri): keep IPv6 brackets when rebuilding a URL - #430

Open
rajanpanth wants to merge 1 commit into
openzim:mainfrom
rajanpanth:fix/ipv6-uri
Open

rajanpanth wants to merge 1 commit into
openzim:mainfrom
rajanpanth:fix/ipv6-uri

Conversation

@rajanpanth

Copy link
Copy Markdown

Summary

  • rebuild_uri copied hostname into the authority. For IPv6 that value has no brackets, so http://[::1]:8080/a came back as http://::1:8080/a, which is not a valid URL.
  • Port 0 was also dropped, because the old format string treated it as missing and glued the digit onto the host. An empty port still clears the port, as before.

Test plan

  • pytest tests/uri/test_uri.py (16 passed, including the previous cases)

Made with Cursor

rebuild_uri copied the hostname without brackets, so an IPv6 address was no longer a valid URL. Port 0 was also dropped because it is falsy.

Co-authored-by: Cursor <[email protected]>

This branch has not been deployed

No deployments
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