Skip to content

Commit 6cac054

Browse files
committed
key_separator: fix handling of meta keys
This rebases and cleans a fix from Martin's original PR. Two new test methods fail without it and pass with since keys for meta-files like `.zarray` were being converted into `/zarray`. see: martindurant@5795bc7
1 parent 834c289 commit 6cac054

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

zarr/storage.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,8 @@ class FSStore(MutableMapping):
10161016
storage_options : passed to the fsspec implementation
10171017
"""
10181018

1019+
_META_KEYS = (attrs_key, group_meta_key, array_meta_key)
1020+
10191021
def __init__(self, url, normalize_keys=True, key_separator='.',
10201022
mode='w',
10211023
exceptions=(KeyError, PermissionError, IOError),
@@ -1035,7 +1037,11 @@ def _normalize_key(self, key):
10351037
key = normalize_storage_path(key).lstrip('/')
10361038
if key:
10371039
*bits, end = key.split('/')
1038-
key = '/'.join(bits + [end.replace('.', self.key_separator)])
1040+
1041+
if end not in FSStore._META_KEYS:
1042+
end = end.replace('.', self.key_separator)
1043+
key = '/'.join(bits + [end])
1044+
10391045
return key.lower() if self.normalize_keys else key
10401046

10411047
def getitems(self, keys, **kwargs):

0 commit comments

Comments
 (0)