You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ObjectStore.list_dir corrupts directory names due to lstrip vs removeprefix #3753
_transform_list_dir in zarr/storage/_obstore.py uses str.lstrip(prefix) on line 263 to strip path prefixes from common_prefixes. But lstrip strips individual characters from the argument, not a prefix string. This corrupts directory names when the prefix shares characters with child directory names.
Line 264 already correctly uses removeprefix for objects — the fix is to do the same for prefixes on line 263.
Activity
TomNicholas commentedon Mar 9, 2026
This is very similar to #2778
dcherian commentedon Mar 9, 2026
we should add a pre-commit linter that prevents use of
lstripandrstripAdd regression test for list_dir corrupting directory names (zarr-dev…
Fix list_dir prefix stripping: use removeprefix instead of lstrip
TomNicholas commentedon Mar 9, 2026
oops this is a duplicate of #3639, though the fix for #3639 is not released yet.
@maxrjones this not being released breaks VirtualiZarr's
ZarrParserfor any zarr store not in the root of a bucket... (see zarr-developers/VirtualiZarr#912)