summaryrefslogtreecommitdiffstats
path: root/api4/file.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-05-04 15:45:19 -0400
committerGitHub <noreply@github.com>2017-05-04 15:45:19 -0400
commit49481caf6db89b0853626ac52ab5f786a6887179 (patch)
tree128991892f16d7830097c217db689410a002eb73 /api4/file.go
parent44a8f76d993cdd97785cab7fd55ad9f07c3c757a (diff)
downloadchat-49481caf6db89b0853626ac52ab5f786a6887179.tar.gz
chat-49481caf6db89b0853626ac52ab5f786a6887179.tar.bz2
chat-49481caf6db89b0853626ac52ab5f786a6887179.zip
PLT-6262 Add config setting to disable file attachments (#6301)
* Add config setting to disable file attachments * Add unit tests * Updating UI for no attachments (#6312) * Update UI text on file upload System Console setting (#6313) * Update storage_settings.jsx * Update en.json
Diffstat (limited to 'api4/file.go')
-rw-r--r--api4/file.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/api4/file.go b/api4/file.go
index 6bd751a67..09132b9a1 100644
--- a/api4/file.go
+++ b/api4/file.go
@@ -33,9 +33,13 @@ func InitFile() {
}
func uploadFile(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !*utils.Cfg.FileSettings.EnableFileAttachments {
+ c.Err = model.NewAppError("uploadFile", "api.file.attachments.disabled.app_error", nil, "", http.StatusNotImplemented)
+ return
+ }
+
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
+ c.Err = model.NewAppError("uploadFile", "api.file.upload_file.too_large.app_error", nil, "", http.StatusRequestEntityTooLarge)
return
}