From: Paul Reece Date: Thu, 1 Jul 2021 03:17:02 +0000 (-0400) Subject: rgw: url_decode before parsing copysource in copyobject X-Git-Tag: v16.2.8~97^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=9a4b8b40ed42fe3b942bb2030f926ebb06ec768f;p=ceph.git rgw: url_decode before parsing copysource in copyobject If the copysource on copyobject call was URL-encoded, it would fail as it would not parse the '/' seperating bucket and key name URL encoding may be necessary for certain characters in a copysource, and several public examples show URL encoding the copysource Fixes: #43259 Signed-off-by: Paul Reece (cherry picked from commit b7621625ed69f21a5bf701b3385ddee281ff3715) --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index f022bc376f931..17f7052b3d6c0 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -4978,12 +4978,12 @@ bool RGWCopyObj::parse_copy_location(const std::string_view& url_src, if (dec_src[0] == '/') dec_src.remove_prefix(1); - pos = dec_src.find('/'); + pos = url_decode(dec_src).find('/'); if (pos == string::npos) return false; - bucket_name = url_decode(dec_src.substr(0, pos)); - key.name = url_decode(dec_src.substr(pos + 1)); + bucket_name = url_decode(dec_src).substr(0, pos); + key.name = url_decode(dec_src).substr(pos + 1); if (key.name.empty()) { return false;