Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upath._flavour: fix path parsing for HttpPath on Python3.12 #236

Merged
merged 1 commit into from
Jul 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading