Skip to content

Commit d0ef793

Browse files
committed
strip scheme in from_url in case fsspec fails to
1 parent 8a0a380 commit d0ef793

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/zarr/storage/remote.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ def from_url(
125125
opts = {"asynchronous": True, **opts}
126126

127127
fs, path = fsspec.url_to_fs(url, **opts)
128+
129+
# fsspec is not consistent about removing the scheme from the path, so check and strip it here
130+
# https://github.com/fsspec/filesystem_spec/issues/1722
131+
if "://" in path:
132+
_, path = path.split("://", maxsplit=1)
133+
128134
return cls(fs=fs, path=path, mode=mode, allowed_exceptions=allowed_exceptions)
129135

130136
async def clear(self) -> None:

tests/v3/test_store/test_core.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ async def test_make_store_path(tmpdir: str) -> None:
3939

4040

4141
async def test_make_store_path_fsspec(monkeypatch) -> None:
42-
import fsspec.implementations.memory
43-
44-
monkeypatch.setattr(fsspec.implementations.memory.MemoryFileSystem, "async_impl", True)
45-
store_path = await make_store_path("memory://")
42+
store_path = await make_store_path("http://foo.com/bar")
4643
assert isinstance(store_path.store, RemoteStore)
4744

4845

0 commit comments

Comments
 (0)