Skip to content

Commit

Permalink
fix: empty directory no longer throw FileNotFound + properly detect n…
Browse files Browse the repository at this point in the history
…on-existent directories (#26)
  • Loading branch information
brian-mulier-p authored Nov 8, 2023
1 parent 55b40ba commit 0da8ea7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/java/io/kestra/storage/s3/S3Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,9 @@ public List<FileAttributes> list(String tenantId, URI uri) throws IOException {
})
.map(throwFunction(this::getFileAttributes))
.toList();
if (list.isEmpty()) {
// s3 does not handle directory deleting with a prefix that does not exist will just delete nothing
// Deleting an "empty directory" will at least return the directory name
throw new FileNotFoundException(uri + " (Not Found)");
if(list.isEmpty()) {
// this will throw FileNotFound if there is no directory
this.getAttributes(tenantId, uri);
}
return list;
} catch (NoSuchKeyException exception) {
Expand Down

0 comments on commit 0da8ea7

Please sign in to comment.