]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: aws sync: make bucket name more url friendly
authorAbhishek Lekshmanan <abhishek@suse.com>
Fri, 24 Feb 2017 12:50:53 +0000 (13:50 +0100)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 10 Apr 2018 15:03:10 +0000 (08:03 -0700)
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
src/rgw/rgw_sync_module_aws.cc

index 9a96ec75303c70c594228bcc5a80c265e7a48b13..e67951f56e834b8e8a144ffce16034a822613960 100644 (file)
@@ -16,12 +16,18 @@ static string aws_bucket_name(const RGWBucketInfo& bucket_info, bool user_bucket
   if (user_buckets){
     bucket_name+=bucket_info.owner.tenant + bucket_info.owner.id;
   }
+  bucket_name.erase(std::remove(bucket_name.begin(),bucket_name.end(),'-'));
   return bucket_name;
 }
 
 static string aws_object_name(const RGWBucketInfo& bucket_info, const rgw_obj_key&key, bool user_buckets=false){
-  auto bucket = aws_bucket_name(bucket_info, user_buckets);
-  return bucket + key.name;
+  string bucket_name = aws_bucket_name(bucket_info, user_buckets);
+  string object_name = bucket_name+"/";
+  if (!user_buckets){
+    object_name += bucket_info.bucket.name;
+  }
+  object_name += key.name;
+  return object_name;
 }
 
 struct AWSConfig {