Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bucket notifications - wrong etag, size #8819

Merged
merged 1 commit into from
Feb 24, 2025

Conversation

alphaprinz
Copy link
Contributor

@alphaprinz alphaprinz commented Feb 20, 2025

Explain the changes

  1. Etag was mistakenly cut off of first and last character.
  2. size was wrong.

Issues: Fixed #xxx / Gap #xxx

  1. notification log doesn't have the etag field entered correctly as compared to the put/copy object operation #8816

Testing Instructions:

  1. Upload an object to a bucket with notifications configured.
  2. Get its etag and size (eg using head-object).
  3. Compare with etag and size field in notification.
  • Doc added/updated
  • Tests added

@alphaprinz alphaprinz requested a review from aspandey February 20, 2025 18:31
@alphaprinz alphaprinz changed the title bucket notifications - wrong etag bucket notifications - wrong etag, size Feb 22, 2025
@@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under which circumstances the size would be 0 and reply.size would be non zero?
The opposite is possible but if we have called putobject to upload some data then "size"sould be there if not then reply.size should also be zero.
It is possible that the call to upload was not successful so reply.size might be less than size or zero.

Copy link
Contributor Author

@alphaprinz alphaprinz Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size is zero (and reply.size is not zero) when copy_source is true (see lines 21 and 29).

@@ -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('\"')) {
Copy link
Contributor

@aspandey aspandey Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It starts with '\"' ? shouldn't it be '"\' ? For example: "\test-etag\"
Please keep one example in comment to avoid confusion for code reader.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only option currently for quotation is with double quote marks, "".
That is the only test performed in 424.
I have not seen an etag quoted with single quotes '' yet, so I didn't test for it.

@alphaprinz alphaprinz requested a review from aspandey February 24, 2025 05:42
@alphaprinz alphaprinz merged commit a85e1c2 into noobaa:master Feb 24, 2025
11 checks passed
alphaprinz added a commit to alphaprinz/noobaa-core that referenced this pull request Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants