MM-42813: Fallback to default config if nil is passed (#19920)
https://mattermost.atlassian.net/browse/MM-42813 ```release-note NONE ``` Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
bc69069a83
Коммит
ec91ca46ff
@@ -196,11 +196,9 @@ func getSystemPing(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func testEmail(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
var cfg *model.Config
|
||||
jsonErr := json.NewDecoder(r.Body).Decode(&cfg)
|
||||
if jsonErr != nil {
|
||||
c.Err = model.NewAppError("testEmail", "api.unmarshal_error", nil, jsonErr.Error(), http.StatusBadRequest)
|
||||
return
|
||||
cfg := model.ConfigFromJSON(r.Body)
|
||||
if cfg == nil {
|
||||
cfg = c.App.Config()
|
||||
}
|
||||
|
||||
if checkHasNilFields(&cfg.EmailSettings) {
|
||||
@@ -454,11 +452,9 @@ func getSupportedTimezones(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func testS3(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
var cfg *model.Config
|
||||
jsonErr := json.NewDecoder(r.Body).Decode(&cfg)
|
||||
if jsonErr != nil {
|
||||
c.Err = model.NewAppError("testS3", "api.unmarshal_error", nil, jsonErr.Error(), http.StatusBadRequest)
|
||||
return
|
||||
cfg := model.ConfigFromJSON(r.Body)
|
||||
if cfg == nil {
|
||||
cfg = c.App.Config()
|
||||
}
|
||||
|
||||
if checkHasNilFields(&cfg.FileSettings) {
|
||||
|
||||
Ссылка в новой задаче
Block a user