Skip to content

Commit

Permalink
Use removeprefix rather than replace to avoid separator deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
moradology committed Jan 30, 2025
1 parent fc08f31 commit 90812f5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions changes/2778.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use removeprefix rather than replace when removing filename prefixes in `FsspecStore.list`
2 changes: 1 addition & 1 deletion src/zarr/storage/_fsspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ async def set_partial_values(
async def list(self) -> AsyncIterator[str]:
# docstring inherited
allfiles = await self.fs._find(self.path, detail=False, withdirs=False)
for onefile in (a.replace(self.path + "/", "") for a in allfiles):
for onefile in (a.removeprefix(self.path + "/") for a in allfiles):
yield onefile

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

0 comments on commit 90812f5

Please sign in to comment.