diff --git a/pkg/aws/s3.go b/pkg/aws/s3.go index daffea1..5ee5398 100644 --- a/pkg/aws/s3.go +++ b/pkg/aws/s3.go @@ -6,6 +6,7 @@ import ( "fmt" "image" "io" + "log" "mime/multipart" "path/filepath" "time" @@ -31,6 +32,8 @@ var ( func (svc *AWSService) UploadFile(key string, file multipart.File) (string, error) { newKey := fmt.Sprintf("%s/%s-%d.webp", config.Router.Environment, key, time.Now().Unix()) + log.Printf("Saving file to: %s", newKey) + buf := new(bytes.Buffer) _, err := io.Copy(buf, file) if err != nil { @@ -74,6 +77,8 @@ func (svc *AWSService) UploadFile(key string, file multipart.File) (string, erro func (svc *AWSService) DeleteFile(key string) error { newKey := fmt.Sprintf("%s/%s", config.Router.Environment, key) + log.Printf("Deleting file: %s", newKey) + _, err := svc.s3.DeleteObject(context.TODO(), &s3.DeleteObjectInput{ Bucket: aws.String(config.S3.Bucket), Key: aws.String(newKey),