]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: escape prefix correctly when listing objects
authorYehuda Sadeh <yehuda@inktank.com>
Fri, 14 Jun 2013 21:53:54 +0000 (14:53 -0700)
committerGreg Farnum <greg@inktank.com>
Mon, 17 Jun 2013 17:55:53 +0000 (10:55 -0700)
Fixes: #5362
When listing objects prefix needs to be escaped correctly (the
same as with the marker). Otherwise listing objects with prefix
that starts with underscore doesn't work.
Backport: bobtail, cuttlefish

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
src/rgw/rgw_rados.cc

index b22217994bacaac730868df00302a80913b1b0c9..7a2f2d04d3b08dc4621ffe09243b6e11fc992cfe 100644 (file)
@@ -735,14 +735,18 @@ int RGWRados::list_objects(rgw_bucket& bucket, int max, string& prefix, string&
   }
   result.clear();
 
-  rgw_obj marker_obj;
+  rgw_obj marker_obj, prefix_obj;
   marker_obj.set_ns(ns);
   marker_obj.set_obj(marker);
   string cur_marker = marker_obj.object;
 
+  prefix_obj.set_ns(ns);
+  prefix_obj.set_obj(prefix);
+  string cur_prefix = prefix_obj.object;
+
   do {
     std::map<string, RGWObjEnt> ent_map;
-    int r = cls_bucket_list(bucket, cur_marker, prefix, max - count, ent_map,
+    int r = cls_bucket_list(bucket, cur_marker, cur_prefix, max - count, ent_map,
                             &truncated, &cur_marker);
     if (r < 0)
       return r;