mirror of
https://github.com/distribution/distribution.git
synced 2025-08-21 00:04:10 +00:00
s3: don't use s3.ListObjectsV2Output.KeyCount
This commit is contained in:
parent
6255476b3b
commit
a10b3a9ab4
@ -1105,15 +1105,17 @@ func (d *driver) doWalk(parentCtx context.Context, objectCount *int64, path, pre
|
||||
|
||||
var count int64
|
||||
// KeyCount was introduced with version 2 of the GET Bucket operation in S3.
|
||||
// Some S3 implementations don't support V2 now, so we fall back to manual
|
||||
// calculation of the key count if required
|
||||
if objects.KeyCount != nil {
|
||||
count = *objects.KeyCount
|
||||
*objectCount += *objects.KeyCount
|
||||
} else {
|
||||
count = int64(len(objects.Contents) + len(objects.CommonPrefixes))
|
||||
*objectCount += count
|
||||
}
|
||||
// Some s3 implementations (looking at you ceph/rgw) have a buggy
|
||||
// implementation so we intionally avoid ever using it, preferring instead
|
||||
// to calculate the count from the Contents and CommonPrefixes fields of
|
||||
// the s3.ListObjectsV2Output. we retain the commented out KeyCount code
|
||||
// and this comment so as not to forget this problem moving forward.
|
||||
//
|
||||
// count = *objects.KeyCount
|
||||
// *objectCount += *objects.KeyCount
|
||||
|
||||
count = int64(len(objects.Contents) + len(objects.CommonPrefixes))
|
||||
*objectCount += count
|
||||
|
||||
walkInfos := make([]walkInfoContainer, 0, count)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user