Skip to content

Commit

Permalink
discard 0 byte placeholder object when listing
Browse files Browse the repository at this point in the history
  • Loading branch information
Akopti8 committed Jul 2, 2024
1 parent 2726603 commit 36c6dcd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions blobstore/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ func (bh *BlobHandler) HandleListByPrefix(c echo.Context) error {
}
for _, object := range page.Contents {
// Handle files
// Skip zero-byte objects that match a common prefix with a trailing slash
if *object.Size == 0 && strings.HasSuffix(*object.Key, "/") {
continue
}
if fullAccess || IsPermittedPrefix(bucket, *object.Key, permissions) {
result = append(result, aws.StringValue(object.Key))
}
Expand Down Expand Up @@ -185,6 +189,10 @@ func (bh *BlobHandler) HandleListByPrefixWithDetail(c echo.Context) error {

for _, object := range page.Contents {
// Handle files
// Skip zero-byte objects that match a common prefix with a trailing slash
if *object.Size == 0 && strings.HasSuffix(*object.Key, "/") {
continue
}
if fullAccess || IsPermittedPrefix(bucket, *object.Key, permissions) {
file := ListResult{
ID: count,
Expand Down

0 comments on commit 36c6dcd

Please sign in to comment.