mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Merge pull request #2982 from kmlebedev/issues/2981
avoid empty listMultipartUploads response
This commit is contained in:
commit
4e97b6146a
|
@ -6,6 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/chrislusf/seaweedfs/weed/s3api/s3err"
|
"github.com/chrislusf/seaweedfs/weed/s3api/s3err"
|
||||||
"golang.org/x/exp/slices"
|
"golang.org/x/exp/slices"
|
||||||
|
"math"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -242,13 +243,13 @@ func (s3a *S3ApiServer) listMultipartUploads(input *s3.ListMultipartUploadsInput
|
||||||
Prefix: input.Prefix,
|
Prefix: input.Prefix,
|
||||||
}
|
}
|
||||||
|
|
||||||
entries, isLast, err := s3a.list(s3a.genUploadsFolder(*input.Bucket), "", *input.UploadIdMarker, false, uint32(*input.MaxUploads))
|
entries, _, err := s3a.list(s3a.genUploadsFolder(*input.Bucket), "", *input.UploadIdMarker, false, math.MaxInt32)
|
||||||
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)
|
|
||||||
|
|
||||||
|
uploadsCount := int64(0)
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
if entry.Extended != nil {
|
if entry.Extended != nil {
|
||||||
key := string(entry.Extended["key"])
|
key := string(entry.Extended["key"])
|
||||||
|
@ -262,9 +263,12 @@ func (s3a *S3ApiServer) listMultipartUploads(input *s3.ListMultipartUploadsInput
|
||||||
Key: objectKey(aws.String(key)),
|
Key: objectKey(aws.String(key)),
|
||||||
UploadId: aws.String(entry.Name),
|
UploadId: aws.String(entry.Name),
|
||||||
})
|
})
|
||||||
if !isLast {
|
uploadsCount += 1
|
||||||
output.NextUploadIdMarker = aws.String(entry.Name)
|
}
|
||||||
}
|
if uploadsCount >= *input.MaxUploads {
|
||||||
|
output.IsTruncated = aws.Bool(true)
|
||||||
|
output.NextUploadIdMarker = aws.String(entry.Name)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue