mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-01-18 14:41:31 +08:00
s3: listMultipartUploads fix output format
This commit is contained in:
parent
3eda8d6dfc
commit
baa6bdf4d4
@ -140,35 +140,50 @@ func (s3a *S3ApiServer) abortMultipartUpload(input *s3.AbortMultipartUploadInput
|
|||||||
|
|
||||||
type ListMultipartUploadsResult struct {
|
type ListMultipartUploadsResult struct {
|
||||||
XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListMultipartUploadsResult"`
|
XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListMultipartUploadsResult"`
|
||||||
s3.ListMultipartUploadsOutput
|
|
||||||
|
// copied from s3.ListMultipartUploadsOutput, the Uploads is not converting to <Upload></Upload>
|
||||||
|
Bucket *string `type:"string"`
|
||||||
|
Delimiter *string `type:"string"`
|
||||||
|
EncodingType *string `type:"string" enum:"EncodingType"`
|
||||||
|
IsTruncated *bool `type:"boolean"`
|
||||||
|
KeyMarker *string `type:"string"`
|
||||||
|
MaxUploads *int64 `type:"integer"`
|
||||||
|
NextKeyMarker *string `type:"string"`
|
||||||
|
NextUploadIdMarker *string `type:"string"`
|
||||||
|
Prefix *string `type:"string"`
|
||||||
|
UploadIdMarker *string `type:"string"`
|
||||||
|
Upload []*s3.MultipartUpload `locationName:"Upload" type:"list" flattened:"true"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s3a *S3ApiServer) listMultipartUploads(input *s3.ListMultipartUploadsInput) (output *ListMultipartUploadsResult, code ErrorCode) {
|
func (s3a *S3ApiServer) listMultipartUploads(input *s3.ListMultipartUploadsInput) (output *ListMultipartUploadsResult, code ErrorCode) {
|
||||||
|
// https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListMultipartUploads.html
|
||||||
|
|
||||||
output = &ListMultipartUploadsResult{
|
output = &ListMultipartUploadsResult{
|
||||||
ListMultipartUploadsOutput: s3.ListMultipartUploadsOutput{
|
Bucket: input.Bucket,
|
||||||
Bucket: input.Bucket,
|
Delimiter: input.Delimiter,
|
||||||
Delimiter: input.Delimiter,
|
EncodingType: input.EncodingType,
|
||||||
EncodingType: input.EncodingType,
|
KeyMarker: input.KeyMarker,
|
||||||
KeyMarker: input.KeyMarker,
|
MaxUploads: input.MaxUploads,
|
||||||
MaxUploads: input.MaxUploads,
|
Prefix: input.Prefix,
|
||||||
Prefix: input.Prefix,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
entries, _, err := s3a.list(s3a.genUploadsFolder(*input.Bucket), *input.Prefix, *input.KeyMarker, true, uint32(*input.MaxUploads))
|
entries, isLast, err := s3a.list(s3a.genUploadsFolder(*input.Bucket), *input.Prefix, *input.KeyMarker, true, uint32(*input.MaxUploads))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("listMultipartUploads %s error: %v", *input.Bucket, err)
|
glog.Errorf("listMultipartUploads %s error: %v", *input.Bucket, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
output.IsTruncated = aws.Bool(!isLast)
|
||||||
|
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
if entry.Extended != nil {
|
if entry.Extended != nil {
|
||||||
key := entry.Extended["key"]
|
key := entry.Extended["key"]
|
||||||
output.Uploads = append(output.Uploads, &s3.MultipartUpload{
|
output.Upload = append(output.Upload, &s3.MultipartUpload{
|
||||||
Key: objectKey(aws.String(string(key))),
|
Key: objectKey(aws.String(string(key))),
|
||||||
UploadId: aws.String(entry.Name),
|
UploadId: aws.String(entry.Name),
|
||||||
})
|
})
|
||||||
|
if !isLast {
|
||||||
|
output.NextUploadIdMarker = aws.String(entry.Name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user