From: Casey Bodley Date: Wed, 28 Jun 2023 18:57:49 +0000 (-0400) Subject: rgw: fetch_remote_obj() preserves RGW_ATTR_COMPRESSION of encrypted objects X-Git-Tag: v18.1.3~40^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f8c47d972fff8e478be972b54cc45438d4a9c4be;p=ceph.git rgw: fetch_remote_obj() preserves RGW_ATTR_COMPRESSION of encrypted objects if the source object was both compressed and encrypted, preserve its original compression attribute so it can be decompressed the same way it was originally compressed Signed-off-by: Casey Bodley (cherry picked from commit b91ff3fd86f52f7148daf7f9acc9864752186ce0) --- diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index caf6e70bf17a..69323f571a27 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -3393,8 +3393,12 @@ public: try_etag_verify = false; } + // if the object is both compressed and encrypted, it was transferred + // in its encrypted+compressed form. we need to preserve the original + // RGW_ATTR_COMPRESSION instead of falling back to default compression + // settings auto iter = src_attrs.find(RGW_ATTR_COMPRESSION); - if (iter != src_attrs.end()) { + if (iter != src_attrs.end() && !encrypted) { const bufferlist bl = std::move(iter->second); src_attrs.erase(iter); // don't preserve source compression info