From 51538e18e866051051c88c0f18d530a5f6f25447 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 --- .../s3/ops/s3_get_bucket_notification.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/endpoint/s3/ops/s3_get_bucket_notification.js b/src/endpoint/s3/ops/s3_get_bucket_notification.js index 5106ce91ff..793beb73b1 100644 --- a/src/endpoint/s3/ops/s3_get_bucket_notification.js +++ b/src/endpoint/s3/ops/s3_get_bucket_notification.js @@ -14,6 +14,8 @@ async function get_bucket_notification(req) { result = _.cloneDeep(result); + const TopicConfiguration = []; + //adapt to aws cli structure if (result && result.length > 0) { for (const conf of result) { @@ -23,20 +25,26 @@ async function get_bucket_notification(req) { delete conf.event; delete conf.topic; delete conf.id; + + TopicConfiguration.push({TopicConfiguration: conf}); + } + } + + if (result && result.length > 0) { + for (const conf of result) { + 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; }