From 4089b107a56d3c172d7d583309b70bb776b12866 Mon Sep 17 00:00:00 2001 From: seokjin8678 Date: Tue, 7 May 2024 15:47:42 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20ImageFileUploadService=20jpeg,=20webp?= =?UTF-8?q?=20=ED=99=95=EC=9E=A5=EC=9E=90=20=EC=A7=80=EC=9B=90=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 --- .../com/festago/upload/application/ImageFileUploadService.java | 3 ++- .../src/main/java/com/festago/upload/domain/FileExtension.java | 2 ++ .../festago/upload/application/ImageFileUploadServiceTest.java | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/com/festago/upload/application/ImageFileUploadService.java b/backend/src/main/java/com/festago/upload/application/ImageFileUploadService.java index e42f66687..c8aa4103e 100644 --- a/backend/src/main/java/com/festago/upload/application/ImageFileUploadService.java +++ b/backend/src/main/java/com/festago/upload/application/ImageFileUploadService.java @@ -25,7 +25,8 @@ public class ImageFileUploadService { private static final int MAX_FILE_SIZE = 2_000_000; // 2MB - private static final Set ALLOW_IMAGE_EXTENSION = EnumSet.of(FileExtension.JPG, FileExtension.PNG); + private static final Set ALLOW_IMAGE_EXTENSION = EnumSet.of(FileExtension.JPG, FileExtension.JPEG, + FileExtension.PNG, FileExtension.WEBP); private final StorageClient storageClient; private final UploadFileRepository uploadFileRepository; diff --git a/backend/src/main/java/com/festago/upload/domain/FileExtension.java b/backend/src/main/java/com/festago/upload/domain/FileExtension.java index ef511f693..dbbfdb60b 100644 --- a/backend/src/main/java/com/festago/upload/domain/FileExtension.java +++ b/backend/src/main/java/com/festago/upload/domain/FileExtension.java @@ -8,7 +8,9 @@ @RequiredArgsConstructor public enum FileExtension { JPG(".jpg", MimeTypeUtils.IMAGE_JPEG), + JPEG(".jpeg", MimeTypeUtils.IMAGE_JPEG), PNG(".png", MimeTypeUtils.IMAGE_PNG), + WEBP(".webp", new MimeType("image", "webp")), NONE("", MimeTypeUtils.APPLICATION_OCTET_STREAM), ; diff --git a/backend/src/test/java/com/festago/upload/application/ImageFileUploadServiceTest.java b/backend/src/test/java/com/festago/upload/application/ImageFileUploadServiceTest.java index 108de8663..5e6de5866 100644 --- a/backend/src/test/java/com/festago/upload/application/ImageFileUploadServiceTest.java +++ b/backend/src/test/java/com/festago/upload/application/ImageFileUploadServiceTest.java @@ -41,7 +41,7 @@ void setUp() { } @ParameterizedTest - @ValueSource(strings = {"image.png", "image.jpg"}) + @ValueSource(strings = {"image.png", "image.jpg", "image.jpeg", "image.webp"}) void 이미지를_업로드할때_JPG_PNG_확장자이면_성공한다(String filename) { // given MultipartFile multipartFile = new MockMultipartFile("image", filename, "image/png",