Skip to content

Commit 60e11d7

Browse files
committed
fix FilesystemStore::list
1 parent 76aacb8 commit 60e11d7

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

src/main/java/dev/zarr/zarrjava/store/FilesystemStore.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,18 @@ public void delete(String[] keys) {
121121
}
122122

123123
public Stream<String[]> list(String[] keys) {
124+
Path keyPath = resolveKeys(keys);
124125
try {
125-
return Files.list(resolveKeys(keys)).map(path -> {
126-
Path relativePath = resolveKeys(keys).relativize(path);
127-
String[] parts = new String[relativePath.getNameCount()];
128-
for (int i = 0; i < relativePath.getNameCount(); i++) {
129-
parts[i] = relativePath.getName(i).toString();
130-
}
131-
return parts;
132-
});
126+
return Files.walk(keyPath)
127+
.filter(path -> !path.equals(keyPath))
128+
.map(path -> {
129+
Path relativePath = keyPath.relativize(path);
130+
String[] parts = new String[relativePath.getNameCount()];
131+
for (int i = 0; i < relativePath.getNameCount(); i++) {
132+
parts[i] = relativePath.getName(i).toString();
133+
}
134+
return parts;
135+
});
133136
} catch (IOException e) {
134137
throw new RuntimeException(e);
135138
}

0 commit comments

Comments
 (0)