diff --git a/dandi/files/zarr.py b/dandi/files/zarr.py index d54a9aa10..6982df8cd 100644 --- a/dandi/files/zarr.py +++ b/dandi/files/zarr.py @@ -152,11 +152,11 @@ def dirstat(dirpath: LocalZarrEntry) -> ZarrStat: if p.is_dir(): st = dirstat(p) size += st.size - dir_md5s[str(p)] = (st.digest.value, st.size) + dir_md5s[p.name] = (st.digest.value, st.size) files.extend(st.files) else: size += p.size - file_md5s[str(p)] = (md5file_nocache(p.filepath), p.size) + file_md5s[p.name] = (md5file_nocache(p.filepath), p.size) files.append(p) return ZarrStat( size=size, diff --git a/dandi/tests/test_files.py b/dandi/tests/test_files.py index ddfa375c3..2a333aca8 100644 --- a/dandi/tests/test_files.py +++ b/dandi/tests/test_files.py @@ -313,3 +313,31 @@ def test_upload_zarr(new_dandiset, tmp_path): assert not (file_src.filetree / "arr_2" / "0").exists() assert not (file_src.filetree / "arr_2" / "0").is_file() assert not (file_src.filetree / "arr_2" / "0").is_dir() + + +def test_zarr_properties(tmp_path: Path) -> None: + # This test assumes that the Zarr serialization format never changes + filepath = tmp_path / "example.zarr" + dt = np.dtype("