[#181] index_page: Ignore deleted objects in versioned buckets
All checks were successful
/ Vulncheck (push) Successful in 1m48s
/ Builds (push) Successful in 5m23s
/ Lint (push) Successful in 6m16s
/ Tests (push) Successful in 5m19s

Signed-off-by: Nikita Zinkevich <n.zinkevich@yadro.com>
This commit is contained in:
Nikita Zinkevich 2024-12-16 13:01:50 +03:00 committed by Alexey Vanin
parent a945a947ac
commit a658f3adc0

View file

@ -28,6 +28,7 @@ const (
attrFileName = "FileName" attrFileName = "FileName"
attrFilePath = "FilePath" attrFilePath = "FilePath"
attrSize = "Size" attrSize = "Size"
attrDeleteMarker = "IsDeleteMarker"
) )
type ( type (
@ -46,6 +47,7 @@ type (
Size string Size string
IsDir bool IsDir bool
GetURL string GetURL string
IsDeleteMarker bool
} }
) )
@ -56,6 +58,7 @@ func newListObjectsResponseS3(attrs map[string]string) ResponseObject {
FileName: attrs[attrFileName], FileName: attrs[attrFileName],
Size: attrs[attrSize], Size: attrs[attrSize],
IsDir: attrs[attrOID] == "", IsDir: attrs[attrOID] == "",
IsDeleteMarker: attrs[attrDeleteMarker] == "true",
} }
} }
@ -179,6 +182,9 @@ func (h *Handler) getDirObjectsS3(ctx context.Context, bucketInfo *data.BucketIn
attrs[m.GetKey()] = string(m.GetValue()) attrs[m.GetKey()] = string(m.GetValue())
} }
obj := newListObjectsResponseS3(attrs) obj := newListObjectsResponseS3(attrs)
if obj.IsDeleteMarker {
continue
}
obj.FilePath = prefix + obj.FileName obj.FilePath = prefix + obj.FileName
obj.GetURL = "/get/" + bucketInfo.Name + urlencode(obj.FilePath) obj.GetURL = "/get/" + bucketInfo.Name + urlencode(obj.FilePath)
result.objects = append(result.objects, obj) result.objects = append(result.objects, obj)