fs: Return prefix as listing marker if no objects (#14143)

Fixes #14132
This commit is contained in:
Klaus Post 2022-01-20 10:55:18 -08:00 committed by GitHub
parent 1278b0ec73
commit e1a0a1e73c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -164,6 +164,8 @@ func listObjectsNonSlash(ctx context.Context, bucket, prefix, marker, delimiter
result.IsTruncated = true
if len(objInfos) > 0 {
result.NextMarker = objInfos[len(objInfos)-1].Name
} else if len(result.Prefixes) > 0 {
result.NextMarker = result.Prefixes[len(result.Prefixes)-1]
}
}
@ -399,6 +401,8 @@ func listObjects(ctx context.Context, obj ObjectLayer, bucket, prefix, marker, d
result.IsTruncated = true
if len(objInfos) > 0 {
result.NextMarker = objInfos[len(objInfos)-1].Name
} else if len(result.Prefixes) > 0 {
result.NextMarker = result.Prefixes[len(result.Prefixes)-1]
}
}