Fixed handleImages to properly capture loop variables (#4275)

Этот коммит содержится в:
Harrison Healey
2016-10-20 09:13:33 -04:00
коммит произвёл Joram Wilander
родитель 86aa979310
Коммит 6517b0f9e1

Просмотреть файл

@@ -194,8 +194,8 @@ func doUploadFile(teamId string, channelId string, userId string, rawFilename st
}
func handleImages(previewPathList []string, thumbnailPathList []string, fileData [][]byte) {
for i := range fileData {
go func() {
for i, data := range fileData {
go func(i int, data []byte) {
// Decode image bytes into Image object
img, imgType, err := image.Decode(bytes.NewReader(fileData[i]))
if err != nil {
@@ -236,7 +236,7 @@ func handleImages(previewPathList []string, thumbnailPathList []string, fileData
go generateThumbnailImage(img, thumbnailPathList[i], width, height)
go generatePreviewImage(img, previewPathList[i], width)
}()
}(i, data)
}
}