Skip to content

Commit 90812f5

Browse files
committed
Use removeprefix rather than replace to avoid separator deletion
1 parent fc08f31 commit 90812f5

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

changes/2778.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use removeprefix rather than replace when removing filename prefixes in `FsspecStore.list`

src/zarr/storage/_fsspec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ async def set_partial_values(
341341
async def list(self) -> AsyncIterator[str]:
342342
# docstring inherited
343343
allfiles = await self.fs._find(self.path, detail=False, withdirs=False)
344-
for onefile in (a.replace(self.path + "/", "") for a in allfiles):
344+
for onefile in (a.removeprefix(self.path + "/") for a in allfiles):
345345
yield onefile
346346

347347
async def list_dir(self, prefix: str) -> AsyncIterator[str]:

0 commit comments

Comments
 (0)