Fix: emoji errcheck issues (#28437)
Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9e0d629ab1
Коммит
7af408679e
@@ -74,7 +74,6 @@ issues:
|
|||||||
channels/api4/config_local.go|\
|
channels/api4/config_local.go|\
|
||||||
channels/api4/config_test.go|\
|
channels/api4/config_test.go|\
|
||||||
channels/api4/data_retention.go|\
|
channels/api4/data_retention.go|\
|
||||||
channels/api4/emoji.go|\
|
|
||||||
channels/api4/emoji_test.go|\
|
channels/api4/emoji_test.go|\
|
||||||
channels/api4/export.go|\
|
channels/api4/export.go|\
|
||||||
channels/api4/export_test.go|\
|
channels/api4/export_test.go|\
|
||||||
|
|||||||
@@ -33,7 +33,11 @@ func (api *API) InitEmoji() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createEmoji(c *Context, w http.ResponseWriter, r *http.Request) {
|
func createEmoji(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||||
defer io.Copy(io.Discard, r.Body)
|
defer func() {
|
||||||
|
if _, err := io.Copy(io.Discard, r.Body); err != nil {
|
||||||
|
c.Logger.Warn("Error while discarding request body", mlog.Err(err))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if !*c.App.Config().ServiceSettings.EnableCustomEmoji {
|
if !*c.App.Config().ServiceSettings.EnableCustomEmoji {
|
||||||
c.Err = model.NewAppError("createEmoji", "api.emoji.disabled.app_error", nil, "", http.StatusNotImplemented)
|
c.Err = model.NewAppError("createEmoji", "api.emoji.disabled.app_error", nil, "", http.StatusNotImplemented)
|
||||||
@@ -291,7 +295,9 @@ func getEmojiImage(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
w.Header().Set("Content-Type", "image/"+imageType)
|
w.Header().Set("Content-Type", "image/"+imageType)
|
||||||
w.Header().Set("Cache-Control", "max-age=2592000, private")
|
w.Header().Set("Cache-Control", "max-age=2592000, private")
|
||||||
w.Write(image)
|
if _, err := w.Write(image); err != nil {
|
||||||
|
c.Logger.Warn("Error while writing image response", mlog.Err(err))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func searchEmojis(c *Context, w http.ResponseWriter, r *http.Request) {
|
func searchEmojis(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user