From 0929bc33c0a601139591e8b18feae6c7a14d55be Mon Sep 17 00:00:00 2001 From: Nagarei Date: Wed, 3 Jan 2024 14:23:44 +0900 Subject: [PATCH] =?UTF-8?q?s3=E3=81=AE=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=81=ABContentDisposition=E3=82=92=E3=81=A4=E3=81=91=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit s3にファイルをアップロードする際、metadataではなく直接ContentDispositionをつける --- utils/storage/s3.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/utils/storage/s3.go b/utils/storage/s3.go index 0579b9f11..1e09ad730 100644 --- a/utils/storage/s3.go +++ b/utils/storage/s3.go @@ -139,13 +139,11 @@ func (fs *S3FileStorage) SaveByKey(src io.Reader, key, name, contentType string, } input := &s3.PutObjectInput{ - Bucket: aws.String(fs.bucket), - Key: aws.String(key), - Body: src, - ContentType: aws.String(contentType), - Metadata: map[string]string{ - "Content-Disposition": fmt.Sprintf("attachment; filename*=UTF-8''%s", url.PathEscape(name)), - }, + Bucket: aws.String(fs.bucket), + Key: aws.String(key), + Body: src, + ContentType: aws.String(contentType), + ContentDisposition: aws.String(fmt.Sprintf("attachment; filename*=UTF-8''%s", url.PathEscape(name))), } uploader := manager.NewUploader(fs.client)