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..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,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) {