]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
radosgw: fix doubled underscore with s3/swift server-side copy 19747/head
authorMarcus Watts <mwatts@redhat.com>
Tue, 2 Jan 2018 22:24:38 +0000 (17:24 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Wed, 3 Jan 2018 16:40:37 +0000 (11:40 -0500)
A name is almost an oid.  Except that if a name starts
with a _, the corresponding oid starts with a double _.
The copy logic passes the oid straight in as a name,
which results in a triple _ on the oid, resulting in
an object name with a double __.

Fix: remove one _ when converting an oid back into
a name, so that the final oid only has a double _.

Fixes: http://tracker.ceph.com/issues/22529
This change is not needed on master or Luminous, due to
already-merged #18662.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_rados.cc

index 401955a3e647572c00ebbac039947d7be701cb77..5d4ef12b620d822d7b7a9f29071eabb2590594f2 100644 (file)
@@ -7360,8 +7360,14 @@ int RGWRados::copy_obj_data(RGWObjectCtx& obj_ctx,
   string tag;
   append_rand_alpha(cct, tag, tag, 32);
 
+  string dest_obj_name = dest_obj.get_object();
+  if (dest_obj_name.size() > 2
+       && dest_obj_name[0] == '_' && dest_obj_name[1] == '_') {
+    dest_obj_name.erase(0,1);
+  }
+
   RGWPutObjProcessor_Atomic processor(obj_ctx,
-                                      dest_bucket_info, dest_obj.bucket, dest_obj.get_object(),
+                                      dest_bucket_info, dest_obj.bucket, dest_obj_name,
                                       cct->_conf->rgw_obj_stripe_size, tag, dest_bucket_info.versioning_enabled());
   if (version_id) {
     processor.set_version_id(*version_id);