]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix: S3 API KeyCount incorrect return. 37810/head
author胡玮文 <huww98@outlook.com>
Thu, 24 Sep 2020 15:34:43 +0000 (23:34 +0800)
committerNathan Cutler <ncutler@suse.com>
Mon, 26 Oct 2020 20:16:29 +0000 (21:16 +0100)
KeyCount should return object count + common prefix count.
see S3 example: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html#API_ListObjectsV2_Example_5

Related: https://github.com/docker/distribution/issues/3200

Signed-off-by: 胡玮文 <huww98@outlook.com>
(cherry picked from commit f96a6fdad16da2a7093f538ee577248dfbc65ca1)

src/rgw/rgw_rest_s3.cc

index 9070f86e2d595a07ff36eeb9018b42bf0a62c4ba..703fff8d981112a3f67f715617d063ddb0c34890 100644 (file)
@@ -1139,7 +1139,7 @@ void RGWListBucket_ObjStore_S3v2::send_response()
   if (is_truncated && !next_marker.empty()) {
     s->formatter->dump_string("NextContinuationToken", next_marker.name);
   }
-  s->formatter->dump_int("KeyCount",objs.size());
+  s->formatter->dump_int("KeyCount", objs.size() + common_prefixes.size());
   if (start_after_exist) {
     s->formatter->dump_string("StartAfter", startAfter);
   }