Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.join() and .path.normalize() incorrectly interpret base paths ending /. or /.. #159

Open
andersk opened this issue Aug 13, 2022 · 0 comments

Comments

@andersk
Copy link

andersk commented Aug 13, 2022

When joining URLs, furl correctly treats a path /a/b/c/d/../ as equivalent to /a/b/c/, but it incorrectly treats /a/b/c/d/.. as equivalent to /a/b/c rather than /a/b/c/ (with a trailing slash). This causes further path components to be joined at the wrong level.

>>> furl("http://host/a/b/c/d/../").join("D")  # correct
furl('http://host/a/b/c/D')
>>> furl("http://host/a/b/c/d/..").join("D")  # expected furl('http://host/a/b/c/D')
furl('http://host/a/b/c/d/D')

A similar problem can be observed with .path.normalize(). This one also affects paths ending in /.:

>>> furl("http://host/a/b/c/d/./").path.normalize()  # correct
Path('/a/b/c/d/')
>>> furl("http://host/a/b/c/d/../").path.normalize()  # correct
Path('/a/b/c/')
>>> furl("http://host/a/b/c/d/.").path.normalize()  # expected Path('/a/b/c/d/')
Path('/a/b/c/d')
>>> furl("http://host/a/b/c/d/..").path.normalize()  # expected Path('/a/b/c/')
Path('/a/b/c')
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

No branches or pull requests

1 participant