From: Lumir Sliva Date: Tue, 31 Mar 2026 15:04:16 +0000 (+0200) Subject: rgw: avoid doubled ARN in GetBucketReplication for pre-existing data X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F68137%2Fhead;p=ceph.git rgw: avoid doubled ARN in GetBucketReplication for pre-existing data Before commit b8f89327e1a ("rgw: handle destination bucket as an ARN in ReplicationConfiguration"), the PutBucketReplication handler stored the full ARN string (e.g. "arn:aws:s3:::bucket") as the bucket name in the sync policy. After that commit, the GetBucketReplication handler wraps the stored bucket name in a new ARN via ARN(rgw_bucket).to_string(), which produces a doubled prefix like "arn:aws:s3:::arn:aws:s3:::bucket" for buckets whose replication was configured before the fix. Detect whether the stored bucket name is already a valid S3 ARN and use it directly instead of wrapping it again. New data written after b8f89327e1a stores only the bare bucket name, so the else branch handles that case unchanged. Fixes: https://tracker.ceph.com/issues/75770 Signed-off-by: Lumir Sliva --- diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index a90346b6886a..0b943d36b61a 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -1449,7 +1449,17 @@ struct ReplicationConfiguration { } if (pipe.dest.bucket) { - destination.bucket = ARN(*pipe.dest.bucket).to_string(); + // The bucket name may already contain the full ARN from data + // written before commit b8f89327e1a ("rgw: handle destination + // bucket as an ARN in ReplicationConfiguration"). Detect this + // to avoid producing a doubled ARN like + // "arn:aws:s3:::arn:aws:s3:::bucket". + auto existing = ARN::parse(pipe.dest.bucket->name); + if (existing && existing->service == rgw::Service::s3) { + destination.bucket = existing->to_string(); + } else { + destination.bucket = ARN(*pipe.dest.bucket).to_string(); + } } filter.emplace();