Fix notification unmarshalling, unmarshal only when size is > 0 (#5087)

Fixes #5085
This commit is contained in:
Harshavardhana
2017-10-20 13:57:57 -07:00
committed by Dee Koder
parent f598f4fd1b
commit d82a1da511
2 changed files with 21 additions and 11 deletions
+2 -2
View File
@@ -63,13 +63,13 @@ func (api objectAPIHandlers) GetBucketNotificationHandler(w http.ResponseWriter,
// Attempt to successfully load notification config.
nConfig, err := loadNotificationConfig(bucket, objAPI)
if err != nil && err != errNoSuchNotifications {
if err != nil && errorCause(err) != errNoSuchNotifications {
errorIf(err, "Unable to read notification configuration.")
writeErrorResponse(w, toAPIErrorCode(err), r.URL)
return
}
// For no notifications we write a dummy XML.
if err == errNoSuchNotifications {
if errorCause(err) == errNoSuchNotifications {
// Complies with the s3 behavior in this regard.
nConfig = &notificationConfig{}
}