Changed post drafts to maintain a store a unique id for each file upload to fix issues with duplicate file names

This commit is contained in:
hmhealey
2015-08-10 12:05:45 -04:00
parent 4b74c873cc
commit c9a1bf2d33
7 changed files with 79 additions and 58 deletions

View File

@@ -71,7 +71,9 @@ func uploadFile(c *Context, w http.ResponseWriter, r *http.Request) {
files := m.File["files"]
resStruct := &model.FileUploadResponse{
Filenames: []string{}}
Filenames: []string{},
ClientIds: []string{},
}
imageNameList := []string{}
imageDataList := [][]byte{}
@@ -113,6 +115,10 @@ func uploadFile(c *Context, w http.ResponseWriter, r *http.Request) {
resStruct.Filenames = append(resStruct.Filenames, fileUrl)
}
for _, clientId := range props["client_ids"] {
resStruct.ClientIds = append(resStruct.ClientIds, clientId)
}
fireAndForgetHandleImages(imageNameList, imageDataList, c.Session.TeamId, channelId, c.Session.UserId)
w.Write([]byte(resStruct.ToJson()))