Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
Fixed noSuchKey error (#407)
Browse files Browse the repository at this point in the history
Problem: "NoSuchKey" error was returning when tried copyObject API after applying valid IAM policy on IAM user.

Solution: Previously in copy object API it was considering owner of destination bucket as "user id" and not the actual owner of the bucket. Fixed that by changing owner as destination bucket owner.

Signed-off-by: shraddhaghatol <shraddha.j.ghatol@seagate.com>
  • Loading branch information
shraddhaghatol authored Aug 26, 2022
1 parent 5c7a38b commit ec121d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rgw/rgw_sal_motr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2396,10 +2396,11 @@ int MotrObject::copy_object_same_zone(RGWObjectCtx& obj_ctx,
req_id = *tag;
}

struct req_state* s = static_cast<req_state*>(obj_ctx.get_private());
// prepare write op
std::shared_ptr<rgw::sal::Writer> dst_writer = store->get_atomic_writer(dpp, y,
dest_object->clone(),
user->get_id(), obj_ctx,
s->bucket_owner.get_id(), obj_ctx,
&dest_placement, olh_epoch, req_id);

rc = dst_writer->prepare(y);
Expand Down Expand Up @@ -2450,7 +2451,6 @@ int MotrObject::copy_object_same_zone(RGWObjectCtx& obj_ctx,
}

//Set object tags based on tagging-directive
struct req_state* s = static_cast<req_state*>(obj_ctx.get_private());
auto tagging_drctv = s->info.env->get("HTTP_X_AMZ_TAGGING_DIRECTIVE");

bufferlist tags_bl;
Expand Down

0 comments on commit ec121d3

Please sign in to comment.