[issue18828] urljoin behaves differently with custom and standard schemas

Martin Panter report at bugs.python.org
Thu Mar 26 12:26:37 CET 2015


Martin Panter added the comment:

The current behaviour when no scheme is present is fairly sensible to me and should not be changed to do string concatenation nor raise an exception:

>>> urljoin("//netloc/old/path", "new/path")
'//netloc/old/new/path'

I am posting urljoin-non-hier.patch as an alternative to my first patch. This one changes urljoin() to work on any URL scheme not in the existing “non_hierarchical” blacklist. I removed the gopher, wais, and imap schemes from the list, and added tel, so that urljoin() continues to treat these special cases as before. Out of the schemes mentioned in the module but missing from uses_relative, I think non_hierarchical now has all those without directory components: hdl, mailto, news, sip, sips, snews, tel, telnet.

However I am still not really convinced that my first urljoin-scheme.patch is a bad idea. Do people actually use urljoin() with these schemes like mailto in the first place?

----------
Added file: http://bugs.python.org/file38698/urljoin-non-hier.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18828>
_______________________________________


More information about the Python-bugs-list mailing list