summaryrefslogtreecommitdiffstats
path: root/api/file.go
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-08-10 12:05:45 -0400
committerhmhealey <harrisonmhealey@gmail.com>2015-08-10 14:04:23 -0400
commitc9a1bf2d336cc5718cdf327f37cfdf87dc0e2705 (patch)
treed90cdfebf96ac6a4557a8caaefe06888b7d9d6ba /api/file.go
parent4b74c873cc95973c5434988a41f5e06446a4e586 (diff)
downloadchat-c9a1bf2d336cc5718cdf327f37cfdf87dc0e2705.tar.gz
chat-c9a1bf2d336cc5718cdf327f37cfdf87dc0e2705.tar.bz2
chat-c9a1bf2d336cc5718cdf327f37cfdf87dc0e2705.zip
Changed post drafts to maintain a store a unique id for each file upload to fix issues with duplicate file names
Diffstat (limited to 'api/file.go')
-rw-r--r--api/file.go8
1 files changed, 7 insertions, 1 deletions
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()))