[MM-44604] Ensure we return after setting error in api4/config.go (#20294)

Этот коммит содержится в:
Michael Kochell
2022-06-03 10:14:56 -04:00
коммит произвёл GitHub
родитель 182536b87d
Коммит 7833e595aa

Просмотреть файл

@@ -62,6 +62,7 @@ func getConfig(c *Context, w http.ResponseWriter, r *http.Request) {
})
if err != nil {
c.Err = model.NewAppError("getConfig", "api.config.get_config.restricted_merge.app_error", nil, err.Error(), http.StatusInternalServerError)
return
}
auditRec.Success()
@@ -137,6 +138,7 @@ func updateConfig(c *Context, w http.ResponseWriter, r *http.Request) {
})
if err1 != nil {
c.Err = model.NewAppError("updateConfig", "api.config.update_config.restricted_merge.app_error", nil, err1.Error(), http.StatusInternalServerError)
return
}
// Do not allow plugin uploads to be toggled through the API
@@ -198,7 +200,8 @@ func updateConfig(c *Context, w http.ResponseWriter, r *http.Request) {
},
})
if mergeErr != nil {
c.Err = model.NewAppError("updateConfig", "api.config.update_config.restricted_merge.app_error", nil, err.Error(), http.StatusInternalServerError)
c.Err = model.NewAppError("updateConfig", "api.config.update_config.restricted_merge.app_error", nil, mergeErr.Error(), http.StatusInternalServerError)
return
}
auditRec.Success()
@@ -354,7 +357,8 @@ func patchConfig(c *Context, w http.ResponseWriter, r *http.Request) {
},
})
if mergeErr != nil {
c.Err = model.NewAppError("patchConfig", "api.config.patch_config.restricted_merge.app_error", nil, err.Error(), http.StatusInternalServerError)
c.Err = model.NewAppError("patchConfig", "api.config.patch_config.restricted_merge.app_error", nil, mergeErr.Error(), http.StatusInternalServerError)
return
}
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")