summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-12-14 16:04:10 -0500
committerhmhealey <harrisonmhealey@gmail.com>2015-12-15 09:16:58 -0500
commit76e1f1f6138de9cfea03847af0eff61a10261043 (patch)
tree4ad4831fc97232ad9c2eb83c496a3018cfdfb877 /api
parent6e08669d22cce01a4b1e54c64bc236899c959163 (diff)
downloadchat-76e1f1f6138de9cfea03847af0eff61a10261043.tar.gz
chat-76e1f1f6138de9cfea03847af0eff61a10261043.tar.bz2
chat-76e1f1f6138de9cfea03847af0eff61a10261043.zip
Added serverside file size check for post attachments
Diffstat (limited to 'api')
-rw-r--r--api/file.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/api/file.go b/api/file.go
index 8afc70692..4339e610b 100644
--- a/api/file.go
+++ b/api/file.go
@@ -76,6 +76,12 @@ func uploadFile(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
+ if r.ContentLength > model.MAX_FILE_SIZE {
+ c.Err = model.NewAppError("uploadFile", "Unable to upload file. File is too large.", "")
+ c.Err.StatusCode = http.StatusRequestEntityTooLarge
+ return
+ }
+
err := r.ParseMultipartForm(model.MAX_FILE_SIZE)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)