Skip to content

Commit

Permalink
upath._flavour: fix path parsing due to change in urllib.parse.SplitR…
Browse files Browse the repository at this point in the history
…esult behavior (#236)
  • Loading branch information
ap-- authored Jul 21, 2024
1 parent 431af71 commit 07a4583
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions upath/_flavour.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from typing import Sequence
from typing import TypedDict
from typing import Union
from urllib.parse import SplitResult
from urllib.parse import urlsplit

if sys.version_info >= (3, 12):
Expand Down Expand Up @@ -299,6 +300,12 @@ def splitdrive(self, path: PathOrStr) -> tuple[str, str]:
# cases like: "http://example.com/foo/bar"
drive = u._replace(path="", query="", fragment="").geturl()
rest = u._replace(scheme="", netloc="").geturl()
if (
u.path.startswith("//")
and SplitResult("", "", "//", "", "").geturl() == "////"
):
# see: fsspec/universal_pathlib#233
rest = rest[2:]
return drive, rest or self.root_marker or self.sep
else:
# cases like: "bucket/some/special/key
Expand Down

0 comments on commit 07a4583

Please sign in to comment.