From b24b320807a78d4bf0b7b0fd08dabe10ad46b3b1 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 9 Nov 2018 10:40:03 -0800 Subject: [PATCH] Set notification namespace for NotificationConfiguration (#6789) --- cmd/bucket-notification-handlers.go | 5 +++++ pkg/event/config.go | 1 + 2 files changed, 6 insertions(+) diff --git a/cmd/bucket-notification-handlers.go b/cmd/bucket-notification-handlers.go index 4874a1aab..d54f0fc8c 100644 --- a/cmd/bucket-notification-handlers.go +++ b/cmd/bucket-notification-handlers.go @@ -83,6 +83,11 @@ func (api objectAPIHandlers) GetBucketNotificationHandler(w http.ResponseWriter, nConfig = &event.Config{} } + // If xml namespace is empty, set a default value before returning. + if nConfig.XMLNS == "" { + nConfig.XMLNS = "http://s3.amazonaws.com/doc/2006-03-01/" + } + notificationBytes, err := xml.Marshal(nConfig) if err != nil { logger.LogIf(ctx, err) diff --git a/pkg/event/config.go b/pkg/event/config.go index 5f5e6fea9..5c03c3f46 100644 --- a/pkg/event/config.go +++ b/pkg/event/config.go @@ -204,6 +204,7 @@ type topic struct { // Config - notification configuration described in // http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html type Config struct { + XMLNS string `xml:"xmlns,attr,omitempty"` XMLName xml.Name `xml:"NotificationConfiguration"` QueueList []Queue `xml:"QueueConfiguration,omitempty"` LambdaList []lambda `xml:"CloudFunctionConfiguration,omitempty"`