summaryrefslogtreecommitdiffstats
path: root/api4/brand.go
diff options
context:
space:
mode:
authorJesús Espino <jespinog@gmail.com>2018-07-18 10:07:00 +0200
committerGitHub <noreply@github.com>2018-07-18 10:07:00 +0200
commitb367b1ff4064557deacae0f7ecf77fae4624b8c6 (patch)
tree5b9218d64d0e659424db97c996bd20fa1e7ee8d9 /api4/brand.go
parente718d2544f6c719bc6e31f569400f44d54de3a34 (diff)
downloadchat-b367b1ff4064557deacae0f7ecf77fae4624b8c6.tar.gz
chat-b367b1ff4064557deacae0f7ecf77fae4624b8c6.tar.bz2
chat-b367b1ff4064557deacae0f7ecf77fae4624b8c6.zip
Do not close the connection abruptly on too big file uploads (#9083)
Diffstat (limited to 'api4/brand.go')
-rw-r--r--api4/brand.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/api4/brand.go b/api4/brand.go
index f182e1070..2e3081353 100644
--- a/api4/brand.go
+++ b/api4/brand.go
@@ -4,6 +4,8 @@
package api4
import (
+ "io"
+ "io/ioutil"
"net/http"
"github.com/mattermost/mattermost-server/model"
@@ -27,6 +29,8 @@ func getBrandImage(c *Context, w http.ResponseWriter, r *http.Request) {
}
func uploadBrandImage(c *Context, w http.ResponseWriter, r *http.Request) {
+ defer io.Copy(ioutil.Discard, r.Body)
+
if r.ContentLength > *c.App.Config().FileSettings.MaxFileSize {
c.Err = model.NewAppError("uploadBrandImage", "api.admin.upload_brand_image.too_large.app_error", nil, "", http.StatusRequestEntityTooLarge)
return