[#181] index_page: Ignore deleted objects in versioned buckets
Signed-off-by: Nikita Zinkevich <n.zinkevich@yadro.com>
This commit is contained in:
parent
a945a947ac
commit
a658f3adc0
1 changed files with 24 additions and 18 deletions
|
@ -28,6 +28,7 @@ const (
|
|||
attrFileName = "FileName"
|
||||
attrFilePath = "FilePath"
|
||||
attrSize = "Size"
|
||||
attrDeleteMarker = "IsDeleteMarker"
|
||||
)
|
||||
|
||||
type (
|
||||
|
@ -46,6 +47,7 @@ type (
|
|||
Size string
|
||||
IsDir bool
|
||||
GetURL string
|
||||
IsDeleteMarker bool
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -56,6 +58,7 @@ func newListObjectsResponseS3(attrs map[string]string) ResponseObject {
|
|||
FileName: attrs[attrFileName],
|
||||
Size: attrs[attrSize],
|
||||
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())
|
||||
}
|
||||
obj := newListObjectsResponseS3(attrs)
|
||||
if obj.IsDeleteMarker {
|
||||
continue
|
||||
}
|
||||
obj.FilePath = prefix + obj.FileName
|
||||
obj.GetURL = "/get/" + bucketInfo.Name + urlencode(obj.FilePath)
|
||||
result.objects = append(result.objects, obj)
|
||||
|
|
Loading…
Reference in a new issue