File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 1
1
/* Copyright (C) 2016 NooBaa */
2
2
'use strict' ;
3
3
4
- const S3Error = require ( '../s3_errors' ) . S3Error ;
5
-
6
4
/**
7
5
* http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTnotification.html
8
6
*/
9
7
async function put_bucket_notification ( req ) {
10
8
11
9
const topic_configuration = req . body . NotificationConfiguration ?. TopicConfiguration ;
12
- if ( ! topic_configuration ||
13
- typeof topic_configuration !== 'object' ) throw new S3Error ( S3Error . MalformedXML ) ;
14
10
15
11
//adapt to db shcema
16
- for ( const conf of topic_configuration ) {
17
- conf . id = conf . Id ;
18
- conf . event = conf . Event ;
19
- conf . topic = conf . Topic ;
20
- delete conf . Id ;
21
- delete conf . Event ;
22
- delete conf . Topic ;
12
+ if ( topic_configuration ) {
13
+ for ( const conf of topic_configuration ) {
14
+ conf . id = conf . Id ;
15
+ conf . event = conf . Event ;
16
+ conf . topic = conf . Topic ;
17
+ delete conf . Id ;
18
+ delete conf . Event ;
19
+ delete conf . Topic ;
20
+ }
23
21
}
24
22
25
23
const reply = await req . object_sdk . put_bucket_notification ( {
Original file line number Diff line number Diff line change @@ -306,6 +306,9 @@ function get_connection(connect) {
306
306
307
307
308
308
async function test_notifications ( bucket , connect_files_dir ) {
309
+ if ( ! bucket . notifications ) {
310
+ return ;
311
+ }
309
312
const notificator = new Notificator ( { connect_files_dir} ) ;
310
313
for ( const notif of bucket . notifications ) {
311
314
const connect = await notificator . parse_connect_file ( notif . connect ) ;
You can’t perform that action at this time.
0 commit comments