summaryrefslogtreecommitdiffstats
path: root/api4/context.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2018-03-02 15:55:03 +0000
committerGeorge Goldberg <george@gberg.me>2018-03-02 15:55:03 +0000
commit901acc9703ae58b625b44e7abfd02333b9bab951 (patch)
tree1a8fc17a85544bc7b8064874923e2fe6e3f44354 /api4/context.go
parent21afaf4bedcad578d4f876bb315d1072ccd296e6 (diff)
parent2b3b6051d265edf131d006b2eb14f55284faf1e5 (diff)
downloadchat-901acc9703ae58b625b44e7abfd02333b9bab951.tar.gz
chat-901acc9703ae58b625b44e7abfd02333b9bab951.tar.bz2
chat-901acc9703ae58b625b44e7abfd02333b9bab951.zip
Merge branch 'master' into advanced-permissions-phase-1
Diffstat (limited to 'api4/context.go')
-rw-r--r--api4/context.go18
1 files changed, 16 insertions, 2 deletions
diff --git a/api4/context.go b/api4/context.go
index 19778dda3..62fe55758 100644
--- a/api4/context.go
+++ b/api4/context.go
@@ -212,8 +212,10 @@ func (c *Context) LogAuditWithUserId(userId, extraInfo string) {
func (c *Context) LogError(err *model.AppError) {
- // filter out endless reconnects
- if c.Path == "/api/v3/users/websocket" && err.StatusCode == 401 || err.Id == "web.check_browser_compatibility.app_error" {
+ // Filter out 404s, endless reconnects and browser compatibility errors
+ if err.StatusCode == http.StatusNotFound ||
+ (c.Path == "/api/v3/users/websocket" && err.StatusCode == 401) ||
+ err.Id == "web.check_browser_compatibility.app_error" {
c.LogDebug(err)
} else {
l4g.Error(utils.TDefault("api.context.log.error"), c.Path, err.Where, err.StatusCode,
@@ -447,6 +449,18 @@ func (c *Context) RequireFileId() *Context {
return c
}
+func (c *Context) RequireFilename() *Context {
+ if c.Err != nil {
+ return c
+ }
+
+ if len(c.Params.Filename) == 0 {
+ c.SetInvalidUrlParam("filename")
+ }
+
+ return c
+}
+
func (c *Context) RequirePluginId() *Context {
if c.Err != nil {
return c