diff options
author | Corey Hulen <corey@hulen.com> | 2016-04-28 06:53:30 -0700 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-04-28 09:53:30 -0400 |
commit | 9fecf96d3bf49e7c10cff58f656eabf829c83167 (patch) | |
tree | d7b8fc02ba39f1567fa691d0184f9d69ce6f8916 /api/file.go | |
parent | b49dc28d7e346e775bd75d1cce8046149440c0a4 (diff) | |
download | chat-9fecf96d3bf49e7c10cff58f656eabf829c83167.tar.gz chat-9fecf96d3bf49e7c10cff58f656eabf829c83167.tar.bz2 chat-9fecf96d3bf49e7c10cff58f656eabf829c83167.zip |
PLT-2687 sending email on upgrade and moving profile pic to new location (#2808)
* Fixing CLI and adding unit tests
* Adding the upgrade_db_30 to the help text
* Adding the upgrade_db_30 to the help text
* Adding the upgrade_db_30 to the help text
* Fixing CLI tests
* PLT-2687 sending email on upgrade and moving profile pic to new location
* Fixing img move
* Fixing moving of profile image
* making upgrade email localizable
* Fixing email template
Diffstat (limited to 'api/file.go')
-rw-r--r-- | api/file.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/api/file.go b/api/file.go index c51a4a046..82fcefc7b 100644 --- a/api/file.go +++ b/api/file.go @@ -553,7 +553,7 @@ func WriteFile(f []byte, path string) *model.AppError { return nil } -func moveFile(oldPath, newPath string) *model.AppError { +func MoveFile(oldPath, newPath string) *model.AppError { if utils.Cfg.FileSettings.DriverName == model.IMAGE_DRIVER_S3 { fileData := make(chan []byte) getFileAndForget(oldPath, fileData) @@ -578,6 +578,11 @@ func moveFile(oldPath, newPath string) *model.AppError { return err } } else if utils.Cfg.FileSettings.DriverName == model.IMAGE_DRIVER_LOCAL { + + if err := os.MkdirAll(filepath.Dir(utils.Cfg.FileSettings.Directory+newPath), 0774); err != nil { + return model.NewLocAppError("moveFile", "api.file.move_file.rename.app_error", nil, err.Error()) + } + if err := os.Rename(utils.Cfg.FileSettings.Directory+oldPath, utils.Cfg.FileSettings.Directory+newPath); err != nil { return model.NewLocAppError("moveFile", "api.file.move_file.rename.app_error", nil, err.Error()) } |