Skip to content

Commit

Permalink
bucket notifications - allow empty notifications content to facilitat…
Browse files Browse the repository at this point in the history
…e notification conf removal

Signed-off-by: Amit Prinz Setter <[email protected]>
  • Loading branch information
alphaprinz committed Jan 15, 2025
1 parent 0d2edbc commit fb76345
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/endpoint/s3/ops/s3_put_bucket_notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ const S3Error = require('../s3_errors').S3Error;
async function put_bucket_notification(req) {

const topic_configuration = req.body.NotificationConfiguration?.TopicConfiguration;
if (!topic_configuration ||
typeof topic_configuration !== 'object') throw new S3Error(S3Error.MalformedXML);

//adapt to db shcema
for (const conf of topic_configuration) {
conf.id = conf.Id;
conf.event = conf.Event;
conf.topic = conf.Topic;
delete conf.Id;
delete conf.Event;
delete conf.Topic;
if (topic_configuration) {
for (const conf of topic_configuration) {
conf.id = conf.Id;
conf.event = conf.Event;
conf.topic = conf.Topic;
delete conf.Id;
delete conf.Event;
delete conf.Topic;
}
}

const reply = await req.object_sdk.put_bucket_notification({
Expand Down
3 changes: 3 additions & 0 deletions src/util/notifications_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ function get_connection(connect) {


async function test_notifications(bucket, connect_files_dir) {
if (!bucket.notifications) {
return;
}
const notificator = new Notificator({connect_files_dir});
for (const notif of bucket.notifications) {
const connect = await notificator.parse_connect_file(notif.connect);
Expand Down

0 comments on commit fb76345

Please sign in to comment.