From 0439fd2cd918bb8e1ba4cb8a1bf352a146413b10 Mon Sep 17 00:00:00 2001 From: JunH Date: Wed, 2 Aug 2023 17:54:59 +0900 Subject: [PATCH 1/2] =?UTF-8?q?refactor:=20(##)=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=20=ED=8C=8C=EC=9D=BC=20=EA=B4=80=EB=A0=A8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EC=B6=94=EC=A0=81=EC=9D=84=20=EC=9C=84=ED=95=9C=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../votogether/exception/GlobalExceptionHandler.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/backend/src/main/java/com/votogether/exception/GlobalExceptionHandler.java b/backend/src/main/java/com/votogether/exception/GlobalExceptionHandler.java index feee1b28f..367ceaf35 100644 --- a/backend/src/main/java/com/votogether/exception/GlobalExceptionHandler.java +++ b/backend/src/main/java/com/votogether/exception/GlobalExceptionHandler.java @@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; import org.springframework.web.multipart.MultipartException; +import org.springframework.web.multipart.support.MissingServletRequestPartException; @Slf4j @RestControllerAdvice @@ -76,4 +77,15 @@ public ResponseEntity handleMultipartException(final Multipar .body(ExceptionResponse.from(new BadRequestException(PostExceptionType.WRONG_IMAGE))); } + @ExceptionHandler + public ResponseEntity handleMissingServletRequestPartException(final MissingServletRequestPartException e) { + System.out.println("================================"); + System.out.println("GlobalExceptionHandler.handleMissingServletRequestPartException"); + e.printStackTrace(); + + log.warn("[" + e.getClass() + "] : " + e.getMessage()); + return ResponseEntity.status(HttpStatus.NOT_FOUND) + .body(ExceptionResponse.from(new BadRequestException(PostExceptionType.WRONG_IMAGE))); + } + } From 75fd19d116a9c359cd3705533980e69c46722dca Mon Sep 17 00:00:00 2001 From: JunH Date: Wed, 2 Aug 2023 18:06:56 +0900 Subject: [PATCH 2/2] =?UTF-8?q?refactor:=20(##)=20contentImages=20required?= =?UTF-8?q?=20=EC=86=8D=EC=84=B1=EC=9D=84=20false=EB=A1=9C=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/votogether/domain/post/controller/PostController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/com/votogether/domain/post/controller/PostController.java b/backend/src/main/java/com/votogether/domain/post/controller/PostController.java index ea4df488b..c89ecd348 100644 --- a/backend/src/main/java/com/votogether/domain/post/controller/PostController.java +++ b/backend/src/main/java/com/votogether/domain/post/controller/PostController.java @@ -43,7 +43,7 @@ public class PostController { @PostMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public ResponseEntity save( @RequestPart(name = "request") @Valid final PostCreateRequest request, - @RequestPart(name = "contentImages") final List contentImages, + @RequestPart(name = "contentImages", required = false) final List contentImages, @RequestPart(name = "optionImages") final List optionImages, @Auth final Member loginMember ) {