From 2b27e12445ba51e1fa1ab2aceac5fcb3de66845d Mon Sep 17 00:00:00 2001 From: Jesse Hallam Date: Thu, 10 May 2018 18:16:33 -0400 Subject: MM-10188: expect io.Reader in FileBackend.WriteFile (#8765) This is a reworked set of changes originally from @josephGuo to begin reducing the duplicated memory required when uploading files. --- app/user.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/user.go') diff --git a/app/user.go b/app/user.go index 2b0442e75..2ee410684 100644 --- a/app/user.go +++ b/app/user.go @@ -754,7 +754,7 @@ func (a *App) GetProfileImage(user *model.User) ([]byte, bool, *model.AppError) } if user.LastPictureUpdate == 0 { - if err := a.WriteFile(img, path); err != nil { + if _, err := a.WriteFile(bytes.NewReader(img), path); err != nil { return nil, false, err } } @@ -810,7 +810,7 @@ func (a *App) SetProfileImageFromFile(userId string, file multipart.File) *model path := "users/" + userId + "/profile.png" - if err := a.WriteFile(buf.Bytes(), path); err != nil { + if _, err := a.WriteFile(buf, path); err != nil { return model.NewAppError("SetProfileImage", "api.user.upload_profile_user.upload_profile.app_error", nil, "", http.StatusInternalServerError) } -- cgit v1.2.3-1-g7c22