Skip to content

Preserve empty relative paths during normalization - #208

Open
theman6660 wants to merge 1 commit into
python-hyper:masterfrom
theman6660:codex/preserve-relative-normalization
Open

theman6660 wants to merge 1 commit into
python-hyper:masterfrom
theman6660:codex/preserve-relative-normalization

Conversation

@theman6660

Copy link
Copy Markdown

Normalizing an empty-path relative reference changes its rooted flag, so resolving it against a base URL can discard the base path. For example, normalizing ?x=1 before clicking it from http://example.com/a/b resolves to http://example.com/?x=1 instead of http://example.com/a/b?x=1.

Only add the empty-path slash when a host is present. Regression tests cover empty, query-only, fragment-only, and combined references through URL and DecodedURL; existing absolute-host slash normalization remains covered.

Validation on Windows / Python 3.12:

  • Both new regression tests failed before the fix; 89 URL/DecodedURL tests pass afterward.
  • Tests and module doctests: 134 passed, 3 deselected. The excluded hostname-strategy tests fail Hypothesis filtering health checks on pristine upstream 978f2e6 as well (see Tests are failing due to hypothesis filtering #186). The full suite is not claimed green.
  • Black 21.7b0 on changed files and git diff --check pass. Older interpreter matrix not run.

Found during source inspection. Implementation, tests, and this description were prepared with OpenAI Codex at my request.

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