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 #48441
Comments
Hi, The way urljoin works is a bit funky, equivalent paths do not get import urlparse
import posixpath print urlparse.urljoin('http://www.example.com', '///') The results of the above code are: http://www.example.com/ / http://www.example.com/// / http://www.example.com http://www.example.com// Sometimes the path is cleaned, sometimes it is not. When it is cleaned, The bit of code that is causing problems is commented: # XXX The stuff below is bogus in various ways... If I may be so bold, I would like to see this URL cleaning code stripped A new method/function could be added that cleans a URL. It could have a The URL cleaner could use some of the code from "posixpath". Shorter Thanks, monk.e.boy |
This report almost seems like a bug with urlparse, but it is not. We
>>> urlparse.urlsplit('//')
SplitResult(scheme='', netloc='', path='', query='', fragment='')
>>> urlparse.urlsplit('/')
SplitResult(scheme='', netloc='', path='/', query='', fragment='')
>>> urlparse.urlsplit('///')
SplitResult(scheme='', netloc='', path='/', query='', fragment='') Having this in mind, follow the examples you have provided: print urlparse.urljoin('http://www.example.com///', '//') You will find that they are according the parsing and joining rules as The same is with other examples, monk.e.boy. If you see that urlparse method has a problem, then please point me to This report, is not a valid bug and can be closed. |
Will close soon if nobody is against it. |
Please close this, Daniel. |
Thanks Senthil! |
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: