Skip to content

Commit eb76698

Browse files
committed
Update _transform_list_dir to not remove all items
1 parent c2ebc8f commit eb76698

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/zarr/storage/object_store.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,13 @@ async def _transform_list_dir(
161161
# We assume that the underlying object-store implementation correctly handles the
162162
# prefix, so we don't double-check that the returned results actually start with the
163163
# given prefix.
164-
prefix_len = len(prefix)
164+
prefix_len = len(prefix) + 1 # If one is not added to the length, all items will contain "/"
165165
async for batch in list_stream:
166166
for item in batch:
167-
# Yield this item if "/" does not exist after the prefix.
168-
if "/" not in item["path"][prefix_len:]:
169-
yield item["path"]
167+
# Yield this item if "/" does not exist after the prefix
168+
item_path = item["path"][prefix_len:]
169+
if "/" not in item_path:
170+
yield item_path
170171

171172

172173
class _BoundedRequest(TypedDict):

0 commit comments

Comments
 (0)