mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Fixing minio not closing read object (#4971)
This commit is contained in:
committed by
Harrison Healey
parent
17968f0392
commit
3d8acd4ee1
@@ -833,11 +833,12 @@ func ReadFile(path string) ([]byte, *model.AppError) {
|
||||
return nil, model.NewLocAppError("ReadFile", "api.file.read_file.s3.app_error", nil, err.Error())
|
||||
}
|
||||
bucket := utils.Cfg.FileSettings.AmazonS3Bucket
|
||||
reader, err := s3Clnt.GetObject(bucket, path)
|
||||
minioObject, err := s3Clnt.GetObject(bucket, path)
|
||||
defer minioObject.Close()
|
||||
if err != nil {
|
||||
return nil, model.NewLocAppError("ReadFile", "api.file.read_file.s3.app_error", nil, err.Error())
|
||||
}
|
||||
if f, err := ioutil.ReadAll(reader); err != nil {
|
||||
if f, err := ioutil.ReadAll(minioObject); err != nil {
|
||||
return nil, model.NewLocAppError("ReadFile", "api.file.read_file.s3.app_error", nil, err.Error())
|
||||
} else {
|
||||
return f, nil
|
||||
|
||||
Reference in New Issue
Block a user