diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2018-02-20 10:41:00 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-20 10:41:00 -0500 |
commit | babd795d792e95f6e708af6ee8207ef6877e2b32 (patch) | |
tree | 32116afb6e1ea7b598c41eaddb318cea8fabd132 /api4/context.go | |
parent | f85d9105925a82c5006654b99060506a0ff7d7af (diff) | |
download | chat-babd795d792e95f6e708af6ee8207ef6877e2b32.tar.gz chat-babd795d792e95f6e708af6ee8207ef6877e2b32.tar.bz2 chat-babd795d792e95f6e708af6ee8207ef6877e2b32.zip |
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
Diffstat (limited to 'api4/context.go')
-rw-r--r-- | api4/context.go | 12 |
1 files changed, 12 insertions, 0 deletions
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 |