not empty only if there are actual files in the bucket

This commit is contained in:
Chris Lu
2026-02-23 00:12:04 -08:00
parent 57ab99d13e
commit 8e8edd7706

View File

@@ -557,8 +557,14 @@ func (h *S3TablesHandler) handleDeleteNamespace(w http.ResponseWriter, r *http.R
return err
}
if entry.Entry != nil && !strings.HasPrefix(entry.Entry.Name, ".") {
hasChildren = true
break
// Only consider it a child if it's a table (has metadata) or a file.
// Empty directories left by dropped tables or S3 clients should not
// prevent the namespace from being deleted.
_, hasMetadata := entry.Entry.Extended[ExtendedKeyMetadata]
if hasMetadata || !entry.Entry.IsDirectory {
hasChildren = true
break
}
}
}