]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: url_encode key name and instance in es sync module 24424/head
authorChang Liu <liuchang0812@gmail.com>
Mon, 5 Mar 2018 07:46:43 +0000 (15:46 +0800)
committerAbhishek Lekshmanan <abhishek@suse.com>
Thu, 4 Oct 2018 09:17:10 +0000 (11:17 +0200)
Some objects whose name contains space or other special chars
can't be synced to ES correctly. we need to do url_encode when
we send a HTTP request to ES.

Fixes: tracker.ceph.com/issues/23216
Signed-off-by: Chang Liu <liuchang0812@gmail.com>
(cherry picked from commit 13978bb28b7be809033bf24550b21ed2713ddc9b)

src/rgw/rgw_sync_module_es.cc

index 025ce4bcba644070a45584d6427384d22f33d0d0..775fcd24e2d363a3aba0d9cf3495fef1a5330030 100644 (file)
@@ -149,7 +149,7 @@ struct ElasticConfig {
   }
 
   string get_obj_path(const RGWBucketInfo& bucket_info, const rgw_obj_key& key) {
-    return index_path +  "/object/" + bucket_info.bucket.bucket_id + ":" + key.name + ":" + (key.instance.empty() ? "null" : key.instance);
+    return index_path +  "/object/" + url_encode(bucket_info.bucket.bucket_id + ":" + key.name + ":" + (key.instance.empty() ? "null" : key.instance));
   }
 
   bool should_handle_operation(RGWBucketInfo& bucket_info) {