awscloud: close the file after it's uploaded to S3

Oops, this was forgotten.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2022-08-15 14:59:39 +02:00 committed by Sanne Raymaekers
parent 70b6353918
commit 381bce9ac0

View file

@ -131,6 +131,13 @@ func (a *AWS) Upload(filename, bucket, key string) (*s3manager.UploadOutput, err
return nil, err
}
defer func() {
err := file.Close()
if err != nil {
logrus.Warnf("[AWS] ‼ Failed to close the file uploaded to S3: %v", err)
}
}()
logrus.Infof("[AWS] 🚀 Uploading image to S3: %s/%s", bucket, key)
return a.uploader.Upload(
&s3manager.UploadInput{