Skip to content

Fix dot-segment removal for rootless paths - #156

Open
Haasini-kudala wants to merge 1 commit into
python-hyper:mainfrom
Haasini-kudala:codex/rootless-dot-segments
Open

Haasini-kudala wants to merge 1 commit into
python-hyper:mainfrom
Haasini-kudala:codex/rootless-dot-segments

Conversation

@Haasini-kudala

Copy link
Copy Markdown

Fixes #84.

Resolving ../baz against scheme:foo/bar currently returns scheme:baz. This change preserves the slash introduced when /.. removes the last output segment, producing scheme:/baz as required by RFC 3986 section 5.2.4.

Keep an empty leading segment during dot-segment removal instead of restoring a slash only for paths that originally started with one. Add normalization and resolution regressions for rootless paths, trailing and repeated slashes, excess parent segments, and query/fragment preservation, plus a release note. Sixteen regression cases fail before the fix and pass afterward.

Validation on Python 3.12.14:

  • pytest --cov rfc3986 --cov-fail-under 100 tests/: 2,937 passed, 100% coverage.
  • pre-commit run --all-files --show-diff-on-failure: all hooks passed.
  • python tests/verify_types.py --quiet: passed (76.87%, above the 75% requirement).
  • Strict Sphinx HTML and doctest builds: passed.
  • python -m build: source distribution and wheel built successfully.

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.

Resolution result is not consistent with RFC 3986 when the base has "rootless" path without authority

1 participant