SetConfigHandler should avoid setting an invalid notification config (#6679)

Fixes #6642 
Fixes #6641
This commit is contained in:
Praveen raj Mani 2018-10-23 00:21:26 +05:30 committed by Harshavardhana
parent 06ef8248c3
commit acf46cc3b5
1 changed files with 5 additions and 0 deletions

View File

@ -1114,6 +1114,11 @@ func (a adminAPIHandlers) SetConfigHandler(w http.ResponseWriter, r *http.Reques
return return
} }
if err = config.TestNotificationTargets(); err != nil {
writeCustomErrorResponseJSON(w, ErrAdminConfigBadJSON, err.Error(), r.URL)
return
}
if err = saveServerConfig(ctx, objectAPI, &config); err != nil { if err = saveServerConfig(ctx, objectAPI, &config); err != nil {
writeErrorResponseJSON(w, toAdminAPIErrCode(err), r.URL) writeErrorResponseJSON(w, toAdminAPIErrCode(err), r.URL)
return return