]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix list versions starts with version_id=null 30775/head
authorTianshan Qu <tianshan@xsky.com>
Mon, 26 Aug 2019 12:32:03 +0000 (20:32 +0800)
committerNathan Cutler <ncutler@suse.com>
Mon, 7 Oct 2019 20:02:39 +0000 (22:02 +0200)
list with version_id=null, the null will be treated as a "null" version
in cls rgw_bucket_list, which cause the list return wrong keys

Fixes: https://tracker.ceph.com/issues/41433
Signed-off-by: Tianshan Qu <tianshan@xsky.com>
(cherry picked from commit 120df4bb38f60a9a934ce6c8f8b029ef323221b1)

src/cls/rgw/cls_rgw.cc

index fb90602b185f447e76681785739dd19c0e7c8646..779a0698f09965e6b940f519f331c3729564a64f 100644 (file)
@@ -281,7 +281,11 @@ static int encode_list_index_key(cls_method_context_t hctx, const cls_rgw_obj_ke
   }
 
   string obj_index_key;
-  encode_obj_index_key(key, &obj_index_key);
+  cls_rgw_obj_key tmp_key(key);
+  if (tmp_key.instance == "null") {
+    tmp_key.instance.clear();
+  }
+  encode_obj_versioned_data_key(tmp_key, &obj_index_key);
 
   rgw_bucket_dir_entry entry;