urlpath icon indicating copy to clipboard operation
urlpath copied to clipboard

Erroneous double slash in returned URL

Open impredicative opened this issue 5 years ago • 1 comments

I am trying urlpath 1.1.4 with Python 3.8. The output it's producing has an extra slash:

>>> from urlpath import URL
>>> URL('s3://mybucket/') / 'myprefix'
URL('s3://mybucket//myprefix')

There is an extra slash above between mybucket and myprefix which shouldn't exist.

Compare it with the output of pathlib which is undesirable in another way, but doesn't have this extra slash in that location:

>>> from pathlib import Path
>>> Path('s3://mybucket/') / 'myprefix'
PosixPath('s3:/mybucket/myprefix')

impredicative avatar Feb 13 '20 23:02 impredicative

Possibly related: The .with_scheme method adds a triple slash.

url = URL("www.abc.com").with.scheme("https")
print(url)  # prints https:///www.abc.com

pykong avatar May 14 '21 18:05 pykong