Skip to content

Commit

Permalink
bucket notifications - wrong etag, size (#8819)
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Prinz Setter <[email protected]>
  • Loading branch information
alphaprinz committed Mar 4, 2025
1 parent c219c61 commit 99e991f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/endpoint/s3/ops/s3_put_object.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ async function put_object(req, res) {
}
s3_utils.set_encryption_response_headers(req, res, reply.encryption);

res.size_for_notif = size || reply.size;

if (copy_source) {
// TODO: This needs to be checked regarding copy between diff namespaces
// In that case we do not have the copy_source property and just read and upload the stream
Expand Down
3 changes: 2 additions & 1 deletion src/sdk/namespace_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2450,7 +2450,8 @@ class NamespaceFS {
return {
etag,
encryption,
version_id
version_id,
size: stat.size
};
}

Expand Down
6 changes: 4 additions & 2 deletions src/util/notifications_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ function compose_notification_req(req, res, bucket, notif_conf) {
let eTag = res.getHeader('ETag');
//eslint-disable-next-line
if (eTag && eTag.startsWith('\"') && eTag.endsWith('\"')) {
eTag = eTag.substring(2, eTag.length - 2);
eTag = eTag.substring(1, eTag.length - 1);
}

const event = OP_TO_EVENT[req.op_name];
Expand All @@ -442,7 +442,7 @@ function compose_notification_req(req, res, bucket, notif_conf) {
"x-amz-id-2": req.request_id,
};
notif.s3.object.key = req.params.key;
notif.s3.object.size = res.getHeader('content-length');
notif.s3.object.size = res.size_for_notif;
notif.s3.object.eTag = eTag;
notif.s3.object.versionId = res.getHeader('x-amz-version-id');

Expand All @@ -462,6 +462,8 @@ function compose_notification_req(req, res, bucket, notif_conf) {
notif.s3.object.sequencer = res.seq;
}

delete res.size_for_notif;

return compose_meta(notif, notif_conf, bucket);
}

Expand Down

0 comments on commit 99e991f

Please sign in to comment.