From c83751eba4d102ebd127b8456c31bacf5499b5db Mon Sep 17 00:00:00 2001 From: wugawuga Date: Tue, 12 Sep 2023 20:21:35 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20s3=20path=20=EB=A5=BC=20file=20full?= =?UTF-8?q?=20path=20=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/com/funeat/common/s3/S3Uploader.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/com/funeat/common/s3/S3Uploader.java b/backend/src/main/java/com/funeat/common/s3/S3Uploader.java index 765f188a4..240dfcdf9 100644 --- a/backend/src/main/java/com/funeat/common/s3/S3Uploader.java +++ b/backend/src/main/java/com/funeat/common/s3/S3Uploader.java @@ -57,7 +57,12 @@ private void validateExtension(final MultipartFile image) { } private String getKey(final MultipartFile image) { - return folder + getRandomImageName(image); + return folder + getRandomImageName(image) + getFormat(image); + } + + private String getFormat(final MultipartFile image) { + final String contentType = image.getContentType(); + return contentType.substring(contentType.lastIndexOf("/") + 1); } private String getRandomImageName(final MultipartFile image) { From 15379953fb7b7dabafc7f122472544724d1fc19f Mon Sep 17 00:00:00 2001 From: wugawuga Date: Tue, 12 Sep 2023 20:25:20 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=ED=8C=8C=EC=9D=BC=20=ED=99=95?= =?UTF-8?q?=EC=9E=A5=EC=9E=90=20=EC=95=9E=EC=97=90=20.=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/com/funeat/common/s3/S3Uploader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/com/funeat/common/s3/S3Uploader.java b/backend/src/main/java/com/funeat/common/s3/S3Uploader.java index 240dfcdf9..dd0bc062e 100644 --- a/backend/src/main/java/com/funeat/common/s3/S3Uploader.java +++ b/backend/src/main/java/com/funeat/common/s3/S3Uploader.java @@ -57,7 +57,7 @@ private void validateExtension(final MultipartFile image) { } private String getKey(final MultipartFile image) { - return folder + getRandomImageName(image) + getFormat(image); + return folder + getRandomImageName(image) + "." + getFormat(image); } private String getFormat(final MultipartFile image) {