diff options
author | Saturnino Abril <saturnino.abril@gmail.com> | 2018-07-28 14:27:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-28 14:27:55 +0800 |
commit | 51dc5fa36ed2d5afa72bf630d66693bd99acb916 (patch) | |
tree | bd46add031451bebf3e4a4651a1f3095ed59116d /api4/file.go | |
parent | 6ac82d5171769bf8d543cb6c017d29c0a4c81621 (diff) | |
download | chat-51dc5fa36ed2d5afa72bf630d66693bd99acb916.tar.gz chat-51dc5fa36ed2d5afa72bf630d66693bd99acb916.tar.bz2 chat-51dc5fa36ed2d5afa72bf630d66693bd99acb916.zip |
[MM-10621] Set createAt timestamp on file upload api call to secure upload order of files (#9170)
* set createAt timestamp on file upload api call to secure upload order of files
* fix test on plugin hooks
Diffstat (limited to 'api4/file.go')
-rw-r--r-- | api4/file.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/api4/file.go b/api4/file.go index 3c0944b89..f73a54fb4 100644 --- a/api4/file.go +++ b/api4/file.go @@ -10,6 +10,7 @@ import ( "net/url" "strconv" "strings" + "time" "github.com/mattermost/mattermost-server/app" "github.com/mattermost/mattermost-server/model" @@ -69,6 +70,7 @@ func uploadFile(c *Context, w http.ResponseWriter, r *http.Request) { return } + now := time.Now() var resStruct *model.FileUploadResponse var appErr *model.AppError @@ -100,6 +102,7 @@ func uploadFile(c *Context, w http.ResponseWriter, r *http.Request) { []io.ReadCloser{r.Body}, []string{filename}, []string{}, + now, ) } else { m := r.MultipartForm @@ -120,7 +123,14 @@ func uploadFile(c *Context, w http.ResponseWriter, r *http.Request) { return } - resStruct, appErr = c.App.UploadMultipartFiles(FILE_TEAM_ID, channelId, c.Session.UserId, m.File["files"], m.Value["client_ids"]) + resStruct, appErr = c.App.UploadMultipartFiles( + FILE_TEAM_ID, + channelId, + c.Session.UserId, + m.File["files"], + m.Value["client_ids"], + now, + ) } if appErr != nil { |