]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix listing of objects that start with underscore
authorGiovani Rinaldi <gr.gigio@terra.com.br>
Wed, 5 Apr 2017 19:46:14 +0000 (16:46 -0300)
committerOrit Wasserman <owasserm@redhat.com>
Wed, 21 Jun 2017 11:25:56 +0000 (14:25 +0300)
Current marker and prefix search utilized in rgw's function list_objects should respect index key name in order to correctly list objects which have names starting with underscore.

Fixes: http://tracker.ceph.com/issues/19432
Signed-off-by: Giovani Rinaldi <giovani.rinaldi@azion.com>
src/rgw/rgw_rados.cc

index 88b2710c6efa074692bda6dd57a0150468f32f0c..fcea5a13de28b94c30a42cc995bd31816621b9c4 100644 (file)
@@ -5547,7 +5547,7 @@ int RGWRados::Bucket::List::list_objects(int max, vector<rgw_bucket_dir_entry> *
     bigger_than_delim = buf;
 
     /* if marker points at a common prefix, fast forward it into its upperbound string */
-    int delim_pos = cur_marker.name.find(params.delim, params.prefix.size());
+    int delim_pos = cur_marker.name.find(params.delim, cur_prefix.size());
     if (delim_pos >= 0) {
       string s = cur_marker.name.substr(0, delim_pos);
       s.append(bigger_than_delim);
@@ -5628,10 +5628,12 @@ int RGWRados::Bucket::List::list_objects(int max, vector<rgw_bucket_dir_entry> *
               truncated = true;
               goto done;
             }
-            next_marker = prefix_key;
             (*common_prefixes)[prefix_key] = true;
 
-            skip_after_delim = obj.name.substr(0, delim_pos);
+            int marker_delim_pos = cur_marker.name.find(params.delim, cur_prefix.size());
+            next_marker = cur_marker.name.substr(0, marker_delim_pos + 1);
+
+            skip_after_delim = cur_marker.name.substr(0, marker_delim_pos);
             skip_after_delim.append(bigger_than_delim);
 
             ldout(cct, 20) << "skip_after_delim=" << skip_after_delim << dendl;