diff --git a/backend/internal/s3/s3.go b/backend/internal/s3/s3.go index 10c98f5..6f2fe5c 100644 --- a/backend/internal/s3/s3.go +++ b/backend/internal/s3/s3.go @@ -14,7 +14,7 @@ import ( var Client Uploader type Uploader interface { - Upload(ctx context.Context, bucket, key string, body io.Reader) error + Upload(ctx context.Context, bucket, key string, body io.Reader, contentType string) error Download(ctx context.Context, bucket, key string, w io.Writer) error Delete(ctx context.Context, bucket, key string) error GetURL(ctx context.Context, bucket, key string) (string, error) @@ -49,7 +49,7 @@ func Connect() error { return nil } -func (s *S3Client) Upload(ctx context.Context, bucket, key string, body io.Reader) error { +func (s *S3Client) Upload(ctx context.Context, bucket, key string, body io.Reader, contentType string) error { return fmt.Errorf("S3 Upload not implemented: add AWS SDK v2 dependency") } diff --git a/backend/internal/s3/s3_dev.go b/backend/internal/s3/s3_dev.go index 37914c5..a88ec2e 100644 --- a/backend/internal/s3/s3_dev.go +++ b/backend/internal/s3/s3_dev.go @@ -19,7 +19,7 @@ import ( var Client Uploader type Uploader interface { - Upload(ctx context.Context, bucket, key string, body io.Reader) error + Upload(ctx context.Context, bucket, key string, body io.Reader, contentType string) error Download(ctx context.Context, bucket, key string, w io.Writer) error Delete(ctx context.Context, bucket, key string) error GetURL(ctx context.Context, bucket, key string) (string, error) @@ -167,12 +167,12 @@ func Connect() error { return nil } -func (s *S3Client) Upload(ctx context.Context, bucket, key string, body io.Reader) error { +func (s *S3Client) Upload(ctx context.Context, bucket, key string, body io.Reader, contentType string) error { _, err := s.client.PutObject(ctx, &s3.PutObjectInput{ Bucket: aws.String(bucket), Key: aws.String(key), Body: body, - ContentType: aws.String("image/jpeg"), + ContentType: aws.String(contentType), }) return err }