From b61d0f0e888bd2fc1f0ec21ca1ec4f7959881c22 Mon Sep 17 00:00:00 2001 From: Amit Prinz Setter Date: Mon, 6 Jan 2025 11:01:27 -0800 Subject: [PATCH] bucket notifications - fix TopicConfiguration array for get (github issue 8647) Signed-off-by: Amit Prinz Setter --- src/endpoint/s3/ops/s3_get_bucket_notification.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/endpoint/s3/ops/s3_get_bucket_notification.js b/src/endpoint/s3/ops/s3_get_bucket_notification.js index b5a2d9c021..d7aedcb98a 100644 --- a/src/endpoint/s3/ops/s3_get_bucket_notification.js +++ b/src/endpoint/s3/ops/s3_get_bucket_notification.js @@ -10,29 +10,31 @@ async function get_bucket_notification(req) { bucket_name: req.params.bucket, }); + const TopicConfiguration = []; + //adapt to aws cli structure if (result && result.length > 0) { for (const conf of result) { conf.Event = conf.event; conf.Topic = conf.topic; conf.Id = conf.id; - delete conf.vent; + delete conf.event; delete conf.topic; delete conf.id; + + TopicConfiguration.push({TopicConfiguration: conf}); } } const reply = result && result.length > 0 ? { //return result inside TopicConfiguration tag - NotificationConfiguration: { - TopicConfiguration: result - } + NotificationConfiguration: + TopicConfiguration } : //if there's no notification, return empty NotificationConfiguration tag { NotificationConfiguration: {} }; - return reply; }