summaryrefslogtreecommitdiffstats
path: root/api4/file.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-10-18 15:36:43 -0700
committerGitHub <noreply@github.com>2017-10-18 15:36:43 -0700
commit8e19ba029f889519d93cf272960dce858971106c (patch)
treed8f38ac62661fb8578e2b5c3c619fe31ab29f480 /api4/file.go
parent34a87fa8f47b1447b73e3ae56866b654801b3eee (diff)
downloadchat-8e19ba029f889519d93cf272960dce858971106c.tar.gz
chat-8e19ba029f889519d93cf272960dce858971106c.tar.bz2
chat-8e19ba029f889519d93cf272960dce858971106c.zip
Reduce utils.Cfg references (#7650)
* app.UpdateConfig method * test fix * another test fix * the config override option as-was is just error prone, remove it for now * derp
Diffstat (limited to 'api4/file.go')
-rw-r--r--api4/file.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/api4/file.go b/api4/file.go
index 2c0b85ce7..933640c44 100644
--- a/api4/file.go
+++ b/api4/file.go
@@ -58,17 +58,17 @@ func (api *API) InitFile() {
}
func uploadFile(c *Context, w http.ResponseWriter, r *http.Request) {
- if !*utils.Cfg.FileSettings.EnableFileAttachments {
+ if !*c.App.Config().FileSettings.EnableFileAttachments {
c.Err = model.NewAppError("uploadFile", "api.file.attachments.disabled.app_error", nil, "", http.StatusNotImplemented)
return
}
- if r.ContentLength > *utils.Cfg.FileSettings.MaxFileSize {
+ if r.ContentLength > *c.App.Config().FileSettings.MaxFileSize {
c.Err = model.NewAppError("uploadFile", "api.file.upload_file.too_large.app_error", nil, "", http.StatusRequestEntityTooLarge)
return
}
- if err := r.ParseMultipartForm(*utils.Cfg.FileSettings.MaxFileSize); err != nil {
+ if err := r.ParseMultipartForm(*c.App.Config().FileSettings.MaxFileSize); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
@@ -179,7 +179,7 @@ func getFileLink(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- if !utils.Cfg.FileSettings.EnablePublicLink {
+ if !c.App.Config().FileSettings.EnablePublicLink {
c.Err = model.NewAppError("getPublicLink", "api.file.get_public_link.disabled.app_error", nil, "", http.StatusNotImplemented)
return
}
@@ -269,7 +269,7 @@ func getPublicFile(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- if !utils.Cfg.FileSettings.EnablePublicLink {
+ if !c.App.Config().FileSettings.EnablePublicLink {
c.Err = model.NewAppError("getPublicFile", "api.file.get_public_link.disabled.app_error", nil, "", http.StatusNotImplemented)
return
}
@@ -288,7 +288,7 @@ func getPublicFile(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- if hash != app.GeneratePublicLinkHash(info.Id, *utils.Cfg.FileSettings.PublicLinkSalt) {
+ if hash != app.GeneratePublicLinkHash(info.Id, *c.App.Config().FileSettings.PublicLinkSalt) {
c.Err = model.NewAppError("getPublicFile", "api.file.get_file.public_invalid.app_error", nil, "", http.StatusBadRequest)
http.Redirect(w, r, c.GetSiteURLHeader()+"/error?message="+utils.T(c.Err.Message), http.StatusTemporaryRedirect)
return