1
0
Fork 0
mirror of https://github.com/chrislusf/seaweedfs synced 2024-09-19 15:31:05 +02:00

Fix s3api_object_list_handlers returning contents less than the specified limit when more data actually exists (#4240)

Fix when the stored data is actually enough but s3api_object_list_handlers returns less than the specified limit

Signed-off-by: changlin.shi <changlin.shi@ly.com>
This commit is contained in:
LHHDZ 2023-02-22 15:08:52 +08:00 committed by GitHub
parent ef2f741823
commit db5515eada
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -146,8 +146,10 @@ func (s3a *S3ApiServer) listFilerEntries(bucket string, originalPrefix string, m
// check filer // check filer
err = s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error { err = s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {
for {
empty := true
nextMarker, doErr = s3a.doListFilerEntries(client, reqDir, prefix, cursor, marker, delimiter, false, func(dir string, entry *filer_pb.Entry) { nextMarker, doErr = s3a.doListFilerEntries(client, reqDir, prefix, cursor, marker, delimiter, false, func(dir string, entry *filer_pb.Entry) {
empty = false
if entry.IsDirectory { if entry.IsDirectory {
// https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html // https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html
if delimiter == "/" { // A response can contain CommonPrefixes only if you specify a delimiter. if delimiter == "/" { // A response can contain CommonPrefixes only if you specify a delimiter.
@ -192,12 +194,18 @@ func (s3a *S3ApiServer) listFilerEntries(bucket string, originalPrefix string, m
return doErr return doErr
} }
if !cursor.isTruncated { if cursor.isTruncated {
nextMarker = ""
} else {
if requestDir != "" { if requestDir != "" {
nextMarker = requestDir + "/" + nextMarker nextMarker = requestDir + "/" + nextMarker
} }
break
} else if empty {
nextMarker = ""
break
} else {
// start next loop
marker = nextMarker
}
} }
response = ListBucketResult{ response = ListBucketResult{