Skip to content

Commit 5aed4f5

Browse files
authored
bucket notifications - missing await in failure handling, default topic_configuration in put (#8724)
Signed-off-by: Amit Prinz Setter <[email protected]>
1 parent 8a3e5a3 commit 5aed4f5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/endpoint/s3/ops/s3_put_bucket_notification.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
async function put_bucket_notification(req) {
88

9-
const topic_configuration = req.body.NotificationConfiguration?.TopicConfiguration;
9+
let topic_configuration = req.body.NotificationConfiguration?.TopicConfiguration;
1010

1111
//adapt to db shcema
1212
if (topic_configuration) {
@@ -18,6 +18,8 @@ async function put_bucket_notification(req) {
1818
delete conf.Event;
1919
delete conf.Topic;
2020
}
21+
} else {
22+
topic_configuration = [];
2123
}
2224

2325
const reply = await req.object_sdk.put_bucket_notification({

src/util/notifications_util.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ class Notificator {
142142
} catch (err) {
143143
dbg.error("Failed to notify. err = ", err, ", str =", str);
144144
//re-write the failed notification if it's still configured on the bucket
145-
this.handle_failed_notification(notif, failure_append, err);
145+
if (notif) {
146+
await this.handle_failed_notification(notif, failure_append, err);
147+
}
146148
}
147149
});
148150
//note we can't reject promises here, since Promise.all() is rejected on

0 commit comments

Comments
 (0)