diff --git a/server/.golangci.yml b/server/.golangci.yml index 82e8e840622..304130ac818 100644 --- a/server/.golangci.yml +++ b/server/.golangci.yml @@ -82,7 +82,6 @@ issues: channels/api4/handlers_test.go|\ channels/api4/import_test.go|\ channels/api4/integration_action_test.go|\ - channels/api4/ip_filtering.go|\ channels/api4/ip_filtering_test.go|\ channels/api4/job_test.go|\ channels/api4/license.go|\ diff --git a/server/channels/api4/ip_filtering.go b/server/channels/api4/ip_filtering.go index a7c45cef662..62ab0bab0fb 100644 --- a/server/channels/api4/ip_filtering.go +++ b/server/channels/api4/ip_filtering.go @@ -8,6 +8,7 @@ import ( "net/http" "github.com/mattermost/mattermost/server/public/model" + "github.com/mattermost/mattermost/server/public/shared/mlog" "github.com/mattermost/mattermost/server/v8/channels/app" "github.com/mattermost/mattermost/server/v8/channels/audit" "github.com/mattermost/mattermost/server/v8/einterfaces" @@ -81,7 +82,11 @@ func applyIPFilters(c *Context, w http.ResponseWriter, r *http.Request) { auditRec.Success() - go c.App.SendIPFiltersChangedEmail(c.AppContext, c.AppContext.Session().UserId) + go func() { + if err := c.App.SendIPFiltersChangedEmail(c.AppContext, c.AppContext.Session().UserId); err != nil { + c.Logger.Warn("Failed to send IP filters changed email", mlog.Err(err)) + } + }() if err := json.NewEncoder(w).Encode(updatedAllowedRanges); err != nil { c.Err = model.NewAppError("getIPFilters", "api.context.ip_filtering.get_ip_filters.app_error", nil, "", http.StatusInternalServerError).Wrap(err) @@ -106,5 +111,7 @@ func myIP(c *Context, w http.ResponseWriter, r *http.Request) { return } - w.Write(json) + if _, err := w.Write(json); err != nil { + c.Logger.Warn("Error while writing response", mlog.Err(err)) + } }