[issue44452] Allow paths to be joined without worrying about a leading slash

Serhiy Storchaka report at bugs.python.org
Sun Jun 27 04:20:20 EDT 2021


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

I understand why this problem arose. If you parse an HTTP URL, its path always starts with "/" if not empty. And you usually want to interpret it as a relative to some base directory. But lstrip('/') works well here. In any case you need to have some validation to disallow "..".

I think that adding yet one operation will confuse users. And what to do with C:\foo\bar, C:foo\bar, \\?\c\foo\bar, etc?

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44452>
_______________________________________


More information about the Python-bugs-list mailing list