diff options
author | George Goldberg <george@gberg.me> | 2017-08-25 15:38:13 +0100 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-08-25 10:38:13 -0400 |
commit | 50fc6e1e9e8d286fd6a406cef75e48a28f9427ad (patch) | |
tree | 0689de640729194b9a123ec8bfef36cbecd8cefd /app/user.go | |
parent | 99acf6106833a2186c0f7e07985feac5d9c25de1 (diff) | |
download | chat-50fc6e1e9e8d286fd6a406cef75e48a28f9427ad.tar.gz chat-50fc6e1e9e8d286fd6a406cef75e48a28f9427ad.tar.bz2 chat-50fc6e1e9e8d286fd6a406cef75e48a28f9427ad.zip |
PLT-???? Prepare file upload infrastructure for Data Retention. (#7266)
* Prepare file upload infrastructure for Data Retention.
This commit prepares the file upload infrastructure for the data
retention feature that is under construction. Changes are:
* Move file management code to utils to allow access to it from jobs.
* From now on, store all file uploads in a top level folder which is the
date of the day on which they were uploaded.
This commit is based on Harrison Healey's branch, but updated to work
with the latest master.
* Use NewAppError
Diffstat (limited to 'app/user.go')
-rw-r--r-- | app/user.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/user.go b/app/user.go index 813421a5c..40e32c282 100644 --- a/app/user.go +++ b/app/user.go @@ -758,7 +758,7 @@ func GetProfileImage(user *model.User) ([]byte, bool, *model.AppError) { } else { path := "users/" + user.Id + "/profile.png" - if data, err := ReadFile(path); err != nil { + if data, err := utils.ReadFile(path); err != nil { readFailed = true if img, err = CreateProfileImage(user.Username, user.Id); err != nil { @@ -766,7 +766,7 @@ func GetProfileImage(user *model.User) ([]byte, bool, *model.AppError) { } if user.LastPictureUpdate == 0 { - if err := WriteFile(img, path); err != nil { + if err := utils.WriteFile(img, path); err != nil { return nil, false, err } } @@ -819,7 +819,7 @@ func SetProfileImage(userId string, imageData *multipart.FileHeader) *model.AppE path := "users/" + userId + "/profile.png" - if err := WriteFile(buf.Bytes(), path); err != nil { + if err := utils.WriteFile(buf.Bytes(), path); err != nil { return model.NewLocAppError("SetProfileImage", "api.user.upload_profile_user.upload_profile.app_error", nil, "") } |