Skip to content

Commit 07a4583

Browse files
authored
upath._flavour: fix path parsing due to change in urllib.parse.SplitResult behavior (#236)
1 parent 431af71 commit 07a4583

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

upath/_flavour.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from typing import Sequence
1212
from typing import TypedDict
1313
from typing import Union
14+
from urllib.parse import SplitResult
1415
from urllib.parse import urlsplit
1516

1617
if sys.version_info >= (3, 12):
@@ -299,6 +300,12 @@ def splitdrive(self, path: PathOrStr) -> tuple[str, str]:
299300
# cases like: "http://example.com/foo/bar"
300301
drive = u._replace(path="", query="", fragment="").geturl()
301302
rest = u._replace(scheme="", netloc="").geturl()
303+
if (
304+
u.path.startswith("//")
305+
and SplitResult("", "", "//", "", "").geturl() == "////"
306+
):
307+
# see: fsspec/universal_pathlib#233
308+
rest = rest[2:]
302309
return drive, rest or self.root_marker or self.sep
303310
else:
304311
# cases like: "bucket/some/special/key

0 commit comments

Comments
 (0)