summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2015-12-15 09:54:16 -0500
committerJoram Wilander <jwawilander@gmail.com>2015-12-15 09:54:16 -0500
commitba149bd971a5111808a7aaa6478c8de885b9f6ae (patch)
tree678de9f42fda34dad016c9812ca27db8cfb03cf2 /api
parent2980a56370dfe150952beeb97c25e5e21e7fc7e5 (diff)
parent76e1f1f6138de9cfea03847af0eff61a10261043 (diff)
downloadchat-ba149bd971a5111808a7aaa6478c8de885b9f6ae.tar.gz
chat-ba149bd971a5111808a7aaa6478c8de885b9f6ae.tar.bz2
chat-ba149bd971a5111808a7aaa6478c8de885b9f6ae.zip
Merge pull request #1729 from hmhealey/plt886
PLT-886 Add additional max file size checks
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)