From babd795d792e95f6e708af6ee8207ef6877e2b32 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Tue, 20 Feb 2018 10:41:00 -0500 Subject: MM-9556 Added ability to upload files without a multipart request (#8306) * MM-9556 Added ability to upload files without a multipart request * MM-9556 Handled some unusual test behaviour --- api4/context.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'api4/context.go') diff --git a/api4/context.go b/api4/context.go index 82c8d9e6c..9f60ab01e 100644 --- a/api4/context.go +++ b/api4/context.go @@ -447,6 +447,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 -- cgit v1.2.3-1-g7c22 From 659ce8c60012a7d5fd597997b1794ac512b3b155 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Wed, 21 Feb 2018 09:20:10 -0500 Subject: Change log level of 404s to DEBUG (#8339) --- api4/context.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'api4/context.go') diff --git a/api4/context.go b/api4/context.go index 82c8d9e6c..e079428ac 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, -- cgit v1.2.3-1-g7c22