Skip to content

Keep the trailing slash after a final '..' in HTTPPath.resolve() - #606

Open
cig13zs wants to merge 1 commit into
fsspec:mainfrom
cig13zs:http-resolve-final-dotdot
Open

cig13zs wants to merge 1 commit into
fsspec:mainfrom
cig13zs:http-resolve-final-dotdot

Conversation

@cig13zs

@cig13zs cig13zs commented Dec 2, 2026

Copy link
Copy Markdown

HTTPPath.resolve() dropped the trailing slash when the path ended in .., so it pointed at a file instead of the directory:

>>> from upath import UPath
>>> str(UPath("https://example.com/a/b/..").resolve(follow_redirects=False))
'https://example.com/a'    # before
'https://example.com/a/'   # after

RFC 3986 section 5.2.4 (and curl) give /a/. This is the http-final-dotdot xfail in test_special_paths.py.

The special case in resolve() only handled a .. right after an empty segment (a//..). It now appends an empty segment after any final .., which covers that case too.

Removed the xfail and its KNOWN_ISSUES entry, and added a/b/.. and a/b/../c/.. to the http normalization table. The full suite passes locally apart from test_httppath, which needs internet and fails the same way on main here. pre-commit is clean.

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