]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix get_resource_mgr() to correctly identify resource
authorYehuda Sadeh <yehuda@inktank.com>
Fri, 7 Jun 2013 04:47:21 +0000 (21:47 -0700)
committerGreg Farnum <greg@inktank.com>
Fri, 7 Jun 2013 20:52:14 +0000 (13:52 -0700)
Fixes: #5262
The original test was not comparing the correct string, ended up
with the effect of just checking the substring of the uri to match
the resource.

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

index 48d09d69ca69eb9021c103ce96bd2ffe6bef02d0..35d9b17294562ec2c4a5adc45d6b2d2d5706df72 100644 (file)
@@ -1183,8 +1183,8 @@ RGWRESTMgr *RGWRESTMgr::get_resource_mgr(struct req_state *s, const string& uri)
   for (iter = resources_by_size.rbegin(); iter != resources_by_size.rend(); ++iter) {
     string& resource = iter->second;
     if (uri.compare(0, iter->first, resource) == 0 &&
-       (resource.size() == iter->first ||
-        resource[iter->first] == '/')) {
+       (uri.size() == iter->first ||
+        uri[iter->first] == '/')) {
       string suffix = uri.substr(iter->first);
       return resource_mgrs[resource]->get_resource_mgr(s, suffix);
     }