diff options
author | Thomas Balthazar <tbalthazar@users.noreply.github.com> | 2016-05-24 15:07:42 +0200 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2016-05-24 09:07:42 -0400 |
commit | 7e2b539de484ac4f2e97eafce6b8d63ffa2caf13 (patch) | |
tree | e85b742e695c611958f249a4e39d0e6370c1f9b0 /api | |
parent | 8e5c31859012516afcfc28eddbb644a4c96fe9d3 (diff) | |
download | chat-7e2b539de484ac4f2e97eafce6b8d63ffa2caf13.tar.gz chat-7e2b539de484ac4f2e97eafce6b8d63ffa2caf13.tar.bz2 chat-7e2b539de484ac4f2e97eafce6b8d63ffa2caf13.zip |
Max_File_Size setting in System Console > File Settings (#3070)
Diffstat (limited to 'api')
-rw-r--r-- | api/admin.go | 4 | ||||
-rw-r--r-- | api/file.go | 4 | ||||
-rw-r--r-- | api/license.go | 9 | ||||
-rw-r--r-- | api/user.go | 4 |
4 files changed, 11 insertions, 10 deletions
diff --git a/api/admin.go b/api/admin.go index 8f66f60c1..c2dfa37d0 100644 --- a/api/admin.go +++ b/api/admin.go @@ -437,13 +437,13 @@ func uploadBrandImage(c *Context, w http.ResponseWriter, r *http.Request) { return } - if r.ContentLength > model.MAX_FILE_SIZE { + if r.ContentLength > *utils.Cfg.FileSettings.MaxFileSize { c.Err = model.NewLocAppError("uploadBrandImage", "api.admin.upload_brand_image.too_large.app_error", nil, "") c.Err.StatusCode = http.StatusRequestEntityTooLarge return } - if err := r.ParseMultipartForm(model.MAX_FILE_SIZE); err != nil { + if err := r.ParseMultipartForm(*utils.Cfg.FileSettings.MaxFileSize); err != nil { c.Err = model.NewLocAppError("uploadBrandImage", "api.admin.upload_brand_image.parse.app_error", nil, "") return } diff --git a/api/file.go b/api/file.go index f4d1e0005..e29bb072a 100644 --- a/api/file.go +++ b/api/file.go @@ -77,13 +77,13 @@ func uploadFile(c *Context, w http.ResponseWriter, r *http.Request) { return } - if r.ContentLength > model.MAX_FILE_SIZE { + if r.ContentLength > *utils.Cfg.FileSettings.MaxFileSize { c.Err = model.NewLocAppError("uploadFile", "api.file.upload_file.too_large.app_error", nil, "") c.Err.StatusCode = http.StatusRequestEntityTooLarge return } - err := r.ParseMultipartForm(model.MAX_FILE_SIZE) + err := r.ParseMultipartForm(*utils.Cfg.FileSettings.MaxFileSize) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return diff --git a/api/license.go b/api/license.go index 1dbb2b281..f9ecce486 100644 --- a/api/license.go +++ b/api/license.go @@ -5,12 +5,13 @@ package api import ( "bytes" - l4g "github.com/alecthomas/log4go" - "github.com/mattermost/platform/model" - "github.com/mattermost/platform/utils" "io" "net/http" "strings" + + l4g "github.com/alecthomas/log4go" + "github.com/mattermost/platform/model" + "github.com/mattermost/platform/utils" ) const ( @@ -48,7 +49,7 @@ func LoadLicense() { func addLicense(c *Context, w http.ResponseWriter, r *http.Request) { c.LogAudit("attempt") - err := r.ParseMultipartForm(model.MAX_FILE_SIZE) + err := r.ParseMultipartForm(*utils.Cfg.FileSettings.MaxFileSize) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return diff --git a/api/user.go b/api/user.go index ac99bd21b..628e978e9 100644 --- a/api/user.go +++ b/api/user.go @@ -1178,13 +1178,13 @@ func uploadProfileImage(c *Context, w http.ResponseWriter, r *http.Request) { return } - if r.ContentLength > model.MAX_FILE_SIZE { + if r.ContentLength > *utils.Cfg.FileSettings.MaxFileSize { c.Err = model.NewLocAppError("uploadProfileImage", "api.user.upload_profile_user.too_large.app_error", nil, "") c.Err.StatusCode = http.StatusRequestEntityTooLarge return } - if err := r.ParseMultipartForm(model.MAX_FILE_SIZE); err != nil { + if err := r.ParseMultipartForm(*utils.Cfg.FileSettings.MaxFileSize); err != nil { c.Err = model.NewLocAppError("uploadProfileImage", "api.user.upload_profile_user.parse.app_error", nil, "") return } |