summaryrefslogtreecommitdiffstats
path: root/api4/file.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-08-31 15:03:16 +0100
committerJoram Wilander <jwawilander@gmail.com>2017-08-31 10:03:16 -0400
commit63b10be020deffecba0c5eef8e5872418215b464 (patch)
tree192c061ba8abc8c07b4241fa1d186c0152f8267a /api4/file.go
parentb37e17c03259b592e0bc735d48d15d7cf34469e4 (diff)
downloadchat-63b10be020deffecba0c5eef8e5872418215b464.tar.gz
chat-63b10be020deffecba0c5eef8e5872418215b464.tar.bz2
chat-63b10be020deffecba0c5eef8e5872418215b464.zip
APIv4: NewLocAppError -> NewAppError (#7328)
Diffstat (limited to 'api4/file.go')
-rw-r--r--api4/file.go21
1 files changed, 7 insertions, 14 deletions
diff --git a/api4/file.go b/api4/file.go
index 7dc13dafc..ab71b998b 100644
--- a/api4/file.go
+++ b/api4/file.go
@@ -160,8 +160,7 @@ func getFileThumbnail(c *Context, w http.ResponseWriter, r *http.Request) {
}
if info.ThumbnailPath == "" {
- c.Err = model.NewLocAppError("getFileThumbnail", "api.file.get_file_thumbnail.no_thumbnail.app_error", nil, "file_id="+info.Id)
- c.Err.StatusCode = http.StatusBadRequest
+ c.Err = model.NewAppError("getFileThumbnail", "api.file.get_file_thumbnail.no_thumbnail.app_error", nil, "file_id="+info.Id, http.StatusBadRequest)
return
}
@@ -181,8 +180,7 @@ func getFileLink(c *Context, w http.ResponseWriter, r *http.Request) {
}
if !utils.Cfg.FileSettings.EnablePublicLink {
- c.Err = model.NewLocAppError("getPublicLink", "api.file.get_public_link.disabled.app_error", nil, "")
- c.Err.StatusCode = http.StatusNotImplemented
+ c.Err = model.NewAppError("getPublicLink", "api.file.get_public_link.disabled.app_error", nil, "", http.StatusNotImplemented)
return
}
@@ -198,8 +196,7 @@ func getFileLink(c *Context, w http.ResponseWriter, r *http.Request) {
}
if len(info.PostId) == 0 {
- c.Err = model.NewLocAppError("getPublicLink", "api.file.get_public_link.no_post.app_error", nil, "file_id="+info.Id)
- c.Err.StatusCode = http.StatusBadRequest
+ c.Err = model.NewAppError("getPublicLink", "api.file.get_public_link.no_post.app_error", nil, "file_id="+info.Id, http.StatusBadRequest)
return
}
@@ -232,8 +229,7 @@ func getFilePreview(c *Context, w http.ResponseWriter, r *http.Request) {
}
if info.PreviewPath == "" {
- c.Err = model.NewLocAppError("getFilePreview", "api.file.get_file_preview.no_preview.app_error", nil, "file_id="+info.Id)
- c.Err.StatusCode = http.StatusBadRequest
+ c.Err = model.NewAppError("getFilePreview", "api.file.get_file_preview.no_preview.app_error", nil, "file_id="+info.Id, http.StatusBadRequest)
return
}
@@ -274,8 +270,7 @@ func getPublicFile(c *Context, w http.ResponseWriter, r *http.Request) {
}
if !utils.Cfg.FileSettings.EnablePublicLink {
- c.Err = model.NewLocAppError("getPublicFile", "api.file.get_public_link.disabled.app_error", nil, "")
- c.Err.StatusCode = http.StatusNotImplemented
+ c.Err = model.NewAppError("getPublicFile", "api.file.get_public_link.disabled.app_error", nil, "", http.StatusNotImplemented)
return
}
@@ -288,14 +283,12 @@ func getPublicFile(c *Context, w http.ResponseWriter, r *http.Request) {
hash := r.URL.Query().Get("h")
if len(hash) == 0 {
- c.Err = model.NewLocAppError("getPublicFile", "api.file.get_file.public_invalid.app_error", nil, "")
- c.Err.StatusCode = http.StatusBadRequest
+ c.Err = model.NewAppError("getPublicFile", "api.file.get_file.public_invalid.app_error", nil, "", http.StatusBadRequest)
return
}
if hash != app.GeneratePublicLinkHash(info.Id, *utils.Cfg.FileSettings.PublicLinkSalt) {
- c.Err = model.NewLocAppError("getPublicFile", "api.file.get_file.public_invalid.app_error", nil, "")
- c.Err.StatusCode = http.StatusBadRequest
+ c.Err = model.NewAppError("getPublicFile", "api.file.get_file.public_invalid.app_error", nil, "", http.StatusBadRequest)
return
}