diff --git a/api/handler/multipart_upload.go b/api/handler/multipart_upload.go index d0a42fb9..19033495 100644 --- a/api/handler/multipart_upload.go +++ b/api/handler/multipart_upload.go @@ -54,11 +54,11 @@ type ( Initiator Initiator `xml:"Initiator"` IsTruncated bool `xml:"IsTruncated"` Key string `xml:"Key"` - MaxParts int `xml:"MaxParts,omitempty"` - NextPartNumberMarker int `xml:"NextPartNumberMarker,omitempty"` + MaxParts int `xml:"MaxParts"` + NextPartNumberMarker int `xml:"NextPartNumberMarker"` Owner Owner `xml:"Owner"` Parts []*layer.Part `xml:"Part"` - PartNumberMarker int `xml:"PartNumberMarker,omitempty"` + PartNumberMarker int `xml:"PartNumberMarker"` StorageClass string `xml:"StorageClass"` UploadID string `xml:"UploadId"` } diff --git a/api/handler/multipart_upload_test.go b/api/handler/multipart_upload_test.go index aef73473..8639119a 100644 --- a/api/handler/multipart_upload_test.go +++ b/api/handler/multipart_upload_test.go @@ -292,13 +292,19 @@ func TestListParts(t *testing.T) { require.Len(t, list.Parts, 2) require.Equal(t, etag1, list.Parts[0].ETag) require.Equal(t, etag2, list.Parts[1].ETag) + require.Zero(t, list.PartNumberMarker) + require.Equal(t, 2, list.NextPartNumberMarker) list = listParts(hc, bktName, objName, uploadInfo.UploadID, "1", http.StatusOK) require.Len(t, list.Parts, 1) require.Equal(t, etag2, list.Parts[0].ETag) + require.Equal(t, 1, list.PartNumberMarker) + require.Equal(t, 2, list.NextPartNumberMarker) list = listParts(hc, bktName, objName, uploadInfo.UploadID, "2", http.StatusOK) require.Len(t, list.Parts, 0) + require.Equal(t, 2, list.PartNumberMarker) + require.Equal(t, 0, list.NextPartNumberMarker) list = listParts(hc, bktName, objName, uploadInfo.UploadID, "7", http.StatusOK) require.Len(t, list.Parts, 0) diff --git a/api/layer/multipart_upload.go b/api/layer/multipart_upload.go index aeb67598..6ee041b5 100644 --- a/api/layer/multipart_upload.go +++ b/api/layer/multipart_upload.go @@ -603,10 +603,10 @@ func (n *Layer) ListParts(ctx context.Context, p *ListPartsParams) (*ListPartsIn if len(parts) > p.MaxParts { res.IsTruncated = true - res.NextPartNumberMarker = parts[p.MaxParts-1].PartNumber parts = parts[:p.MaxParts] } + res.NextPartNumberMarker = parts[len(parts)-1].PartNumber res.Parts = parts return &res, nil