From c9a1bf2d336cc5718cdf327f37cfdf87dc0e2705 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Mon, 10 Aug 2015 12:05:45 -0400 Subject: Changed post drafts to maintain a store a unique id for each file upload to fix issues with duplicate file names --- api/file.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'api/file.go') diff --git a/api/file.go b/api/file.go index bf1c59422..558f9357e 100644 --- a/api/file.go +++ b/api/file.go @@ -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())) -- cgit v1.2.3-1-g7c22