diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-07-20 15:22:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-20 15:22:49 -0700 |
commit | 58839cefb50e56ae5b157b37e9814ae83ceee70b (patch) | |
tree | 5de966481678096fc9567f74f96673b34a65127c /app/file.go | |
parent | e2f4492eadb5d3c58606b1fdd5774b63a07c236a (diff) | |
download | chat-58839cefb50e56ae5b157b37e9814ae83ceee70b.tar.gz chat-58839cefb50e56ae5b157b37e9814ae83ceee70b.tar.bz2 chat-58839cefb50e56ae5b157b37e9814ae83ceee70b.zip |
Upgrading server dependancies (#6984)
Diffstat (limited to 'app/file.go')
-rw-r--r-- | app/file.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/app/file.go b/app/file.go index a4e112e98..31df445b3 100644 --- a/app/file.go +++ b/app/file.go @@ -19,7 +19,6 @@ import ( "net/http" "net/url" "os" - "path" "path/filepath" "strings" "sync" @@ -114,8 +113,12 @@ func MoveFile(oldPath, newPath string) *model.AppError { } bucket := utils.Cfg.FileSettings.AmazonS3Bucket - var copyConds = s3.NewCopyConditions() - if err = s3Clnt.CopyObject(bucket, newPath, "/"+path.Join(bucket, oldPath), copyConds); err != nil { + source := s3.NewSourceInfo(bucket, oldPath, nil) + destination, err := s3.NewDestinationInfo(bucket, newPath, nil, nil) + if err != nil { + return model.NewLocAppError("moveFile", "api.file.write_file.s3.app_error", nil, err.Error()) + } + if err = s3Clnt.CopyObject(destination, source); err != nil { return model.NewLocAppError("moveFile", "api.file.move_file.delete_from_s3.app_error", nil, err.Error()) } if err = s3Clnt.RemoveObject(bucket, oldPath); err != nil { @@ -489,7 +492,7 @@ func HandleImages(previewPathList []string, thumbnailPathList []string, fileData go func(img *image.Image, path string, width int, height int) { defer wg.Done() generateThumbnailImage(*img, path, width, height) - }(img,thumbnailPathList[i], width, height) + }(img, thumbnailPathList[i], width, height) go func(img *image.Image, path string, width int) { defer wg.Done() |