mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Implement upload and get file endpoints for APIv4 (#5396)
* Implement POST /files endpoint for APIv4
* Implement GET /files/{file_id} endpoint for APIv4
This commit is contained in:
@@ -382,12 +382,24 @@ func (c *Context) RequirePostId() *Context {
|
||||
return c
|
||||
}
|
||||
|
||||
func (c *Context) RequireFileId() *Context {
|
||||
if c.Err != nil {
|
||||
return c
|
||||
}
|
||||
|
||||
if len(c.Params.FileId) != 26 {
|
||||
c.SetInvalidUrlParam("file_id")
|
||||
}
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
func (c *Context) RequireTeamName() *Context {
|
||||
if c.Err != nil {
|
||||
return c
|
||||
}
|
||||
|
||||
if !model.IsValidTeamName(c.Params.TeamName){
|
||||
if !model.IsValidTeamName(c.Params.TeamName) {
|
||||
c.SetInvalidUrlParam("team_name")
|
||||
}
|
||||
|
||||
@@ -401,7 +413,7 @@ func (c *Context) RequireChannelName() *Context {
|
||||
|
||||
if !model.IsValidChannelIdentifier(c.Params.ChannelName) {
|
||||
c.SetInvalidUrlParam("channel_name")
|
||||
}
|
||||
}
|
||||
|
||||
return c
|
||||
}
|
||||
@@ -417,5 +429,3 @@ func (c *Context) RequireEmail() *Context {
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user