]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: return additional checksum headers too 68364/head
authorMatt Benjamin <mbenjamin@redhat.com>
Tue, 14 Apr 2026 19:25:28 +0000 (15:25 -0400)
committerMatt Benjamin <mbenjamin@redhat.com>
Tue, 14 Apr 2026 19:55:04 +0000 (15:55 -0400)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_op.cc

index e9245942989014173a7c2fce34c737bbcbbd9071..3810984194c3ae47c717d1739227107544ab18f5 100644 (file)
@@ -7666,6 +7666,36 @@ bool RGWCompleteMultipart::check_previously_completed(const RGWMultiCompleteUplo
                      << "() object etag and re-calculated etag match, etag: "
                      << oetag << dendl;
   etag = oetag;
+
+  /* assign cksum and armored_cksum */
+  auto iter = sattrs.find(RGW_ATTR_CKSUM);
+  if (iter != sattrs.end()) {
+    auto bliter = iter->second.cbegin();
+    try {
+      rgw::cksum::Cksum tcksum;
+      tcksum.decode(bliter);
+      cksum = std::move(tcksum);
+
+      /* extract a multipart etag's part-count suffix, or "" if
+       * (impossibly) it's not present */
+      auto extract_part_count = [](std::string& etag) -> std::string {
+        std::string str{""};
+        auto pos = etag.find("-");
+        if (pos != std::string::npos) {
+          str = etag.substr(pos, etag.length()-pos);
+        }
+          return str;
+      };
+
+      armored_cksum = cksum->to_armor();
+      if (cksum->composite()) {
+        *armored_cksum += extract_part_count(etag);
+      }
+    } catch (buffer::error& err) {
+      ldpp_dout(this, 0) << "ERROR: could not decode stored cksum, caught buffer::error" << dendl;
+    }
+  }
+
   return true;
 }