diff options
author | =Corey Hulen <corey@hulen.com> | 2015-10-20 14:50:03 -0700 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2015-10-20 14:50:03 -0700 |
commit | e1f94590290bf3061fdce48b25b2e74a2c8a0853 (patch) | |
tree | b67ae40ea40f64f2e6c5a29e50b78199ed9a2c63 /api/file.go | |
parent | 1fc12dd8ba2238eba7d154eee55e1381e7415372 (diff) | |
parent | e0cda76eb816da8fda9c42d67197be71201c242e (diff) | |
download | chat-e1f94590290bf3061fdce48b25b2e74a2c8a0853.tar.gz chat-e1f94590290bf3061fdce48b25b2e74a2c8a0853.tar.bz2 chat-e1f94590290bf3061fdce48b25b2e74a2c8a0853.zip |
Merge branch 'master' into PLT-44
Diffstat (limited to 'api/file.go')
-rw-r--r-- | api/file.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/api/file.go b/api/file.go index 429347596..142ef7ac7 100644 --- a/api/file.go +++ b/api/file.go @@ -146,12 +146,12 @@ func uploadFile(c *Context, w http.ResponseWriter, r *http.Request) { resStruct.ClientIds = append(resStruct.ClientIds, clientId) } - fireAndForgetHandleImages(imageNameList, imageDataList, c.Session.TeamId, channelId, c.Session.UserId) + handleImagesAndForget(imageNameList, imageDataList, c.Session.TeamId, channelId, c.Session.UserId) w.Write([]byte(resStruct.ToJson())) } -func fireAndForgetHandleImages(filenames []string, fileData [][]byte, teamId, channelId, userId string) { +func handleImagesAndForget(filenames []string, fileData [][]byte, teamId, channelId, userId string) { go func() { dest := "teams/" + teamId + "/channels/" + channelId + "/users/" + userId + "/" @@ -311,7 +311,7 @@ func getFileInfo(c *Context, w http.ResponseWriter, r *http.Request) { } else { fileData := make(chan []byte) - asyncGetFile(path, fileData) + getFileAndForget(path, fileData) f := <-fileData @@ -378,7 +378,7 @@ func getFile(c *Context, w http.ResponseWriter, r *http.Request) { } fileData := make(chan []byte) - asyncGetFile(path, fileData) + getFileAndForget(path, fileData) if len(hash) > 0 && len(data) > 0 && len(teamId) == 26 { if !model.ComparePassword(hash, fmt.Sprintf("%v:%v", data, utils.Cfg.FileSettings.PublicLinkSalt)) { @@ -423,7 +423,7 @@ func getFile(c *Context, w http.ResponseWriter, r *http.Request) { w.Write(f) } -func asyncGetFile(path string, fileData chan []byte) { +func getFileAndForget(path string, fileData chan []byte) { go func() { data, getErr := readFile(path) if getErr != nil { |