Martin Panter added the comment:
Similarly, I expected this to return "rtmp://host/app?auth=token":
urljoin("rtmp://host/app", "?auth=token")
I'm not sure adding everybody's custom scheme to a hard-coded whitelist is the
best way to do solve this.
Below I have identified some other schemes not in the "uses_relative" list. Is
there any reason why one would use urljoin() with them, but want the base URL
to be ignored (as is the current behaviour)? I looked at test_urlparse.py and
there doesn't seem to be any test cases for these schemes.
>>> all = set().union(uses_relative, uses_netloc, uses_params,
>>> non_hierarchical, uses_query, uses_fragment)
>>> sorted(all.difference(uses_relative))
['git', 'git+ssh', 'hdl', 'mailto', 'news', 'nfs', 'rsync', 'sip', 'sips',
'snews', 'tel', 'telnet']
Even if the behaviour can't be changed, could the documentation for urljoin()
say something like this:
Only the following [uses_relative] schemes are allowed in the base URL; any
other schemes result in the relative URL being returned without being joined to
the base.
----------
nosy: +vadmium
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18828>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com