From 602fd0ffdd5b6cfcf99363921960f02f1bd0d6ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Tue, 10 Jul 2018 10:55:24 +0200 Subject: MM-11189: Do not close the connection abruptly on too big emojis (#9071) --- api4/emoji.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'api4') diff --git a/api4/emoji.go b/api4/emoji.go index 42f66a22a..750f4b6e9 100644 --- a/api4/emoji.go +++ b/api4/emoji.go @@ -4,6 +4,8 @@ package api4 import ( + "io" + "io/ioutil" "net/http" "strings" @@ -28,6 +30,8 @@ func (api *API) InitEmoji() { } func createEmoji(c *Context, w http.ResponseWriter, r *http.Request) { + defer io.Copy(ioutil.Discard, r.Body) + if !*c.App.Config().ServiceSettings.EnableCustomEmoji { c.Err = model.NewAppError("createEmoji", "api.emoji.disabled.app_error", nil, "", http.StatusNotImplemented) return -- cgit v1.2.3-1-g7c22