From 53521efffb1cb92e5f5ce992d4127bf9498d7c33 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 29 Sep 2016 17:43:35 -0700 Subject: [PATCH] rgw: multipart copy-part handle versionId Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_op.h | 1 + src/rgw/rgw_rest_s3.cc | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index 6a970045a344..4d955cd4cbfd 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -659,6 +659,7 @@ protected: string copy_source_tenant_name; string copy_source_bucket_name; string copy_source_object_name; + string copy_source_version_id; off_t copy_source_range_fst; off_t copy_source_range_lst; string etag; diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 0435080d7928..74ca71b21dac 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -1072,6 +1072,14 @@ int RGWPutObj_ObjStore_S3::get_params() } copy_source_object_name = copy_source_bucket_name.substr(pos + 1, copy_source_bucket_name.size()); copy_source_bucket_name = copy_source_bucket_name.substr(0, pos); +#define VERSION_ID_STR "?versionId=" + pos = copy_source_object_name.find(VERSION_ID_STR); + if (pos == std::string::npos) { + url_decode(copy_source_object_name, copy_source_object_name); + } else { + copy_source_version_id = copy_source_object_name.substr(pos + sizeof(VERSION_ID_STR) - 1); + url_decode(copy_source_object_name.substr(0, pos), copy_source_object_name); + } pos = copy_source_bucket_name.find(":"); if (pos == std::string::npos) { copy_source_tenant_name = s->src_tenant_name; -- 2.47.3