From 9a4b8b40ed42fe3b942bb2030f926ebb06ec768f Mon Sep 17 00:00:00 2001 From: Paul Reece Date: Wed, 30 Jun 2021 23:17:02 -0400 Subject: [PATCH] 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) --- src/rgw/rgw_op.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; -- 2.39.5