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
urlparse normalize URL path #46835
Comments
Hi, Doing in the following: urlparse.urljoin( 'http://site.com/', '../../../../path/' )
'http://site.com/../../../../path/'
urlparse.urljoin( 'http://site.com/', '/path/../path/.././path/./' )
'http://site.com/path/../path/.././path/./' These URLs are normalized to http://site.com/path/ in both Firefox and I think the documentation could be improved to point at the http://teethgrinder.co.uk/blog/Normalize-URL-path-python/ I hope my bug report is OK. Thanks for all the code :-) |
Just try it this way.
>>> print urlparse.urljoin('http://site.com/', 'path/../path/.././path/./')
http://site.com/path/
>>> The difference is the inital '/' in the second argument. When you start the path with a '/'
>>> print urlparse.urljoin('http://site.com/', '/path/../path/.././path/./')
http://site.com/path/../path/.././path/./ The RFC (1808) suggests the following. The way to use this would be, this way: >>> print urlparse.urljoin('http://site.com/', 'path/../path/.././path/./')
http://site.com/path/
>>> This is not a bug and can be closed. |
Btw, Thank you for the exciting report monk.e.boy. :-) And one general comment. If the bug is valid, Python official |
Not a bug... |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: