Check err and correctly close file for S3 storage

Signed-off-by: Mustafa Gezen <mustafa@ctrliq.com>
This commit is contained in:
Mustafa Gezen 2022-08-16 14:25:55 +02:00
parent 4016569ce1
commit 302c68a383
Signed by untrusted user who does not match committer: mustafa
GPG Key ID: DCDF010D946438C1

View File

@ -96,6 +96,7 @@ func (s *Storage) DownloadObject(objectName string, path string) error {
if err != nil { if err != nil {
return err return err
} }
defer f.Close()
_, err = s.downloader.Download( _, err = s.downloader.Download(
f, f,
@ -105,7 +106,7 @@ func (s *Storage) DownloadObject(objectName string, path string) error {
}, },
) )
return nil return err
} }
func (s *Storage) ReadObject(objectName string) ([]byte, error) { func (s *Storage) ReadObject(objectName string) ([]byte, error) {