diff --git a/backend/src/main/java/com/edufocus/edufocus/lecture/controller/LectureController.java b/backend/src/main/java/com/edufocus/edufocus/lecture/controller/LectureController.java index 7ad29a6..dfe142c 100644 --- a/backend/src/main/java/com/edufocus/edufocus/lecture/controller/LectureController.java +++ b/backend/src/main/java/com/edufocus/edufocus/lecture/controller/LectureController.java @@ -36,6 +36,10 @@ public class LectureController { return new ResponseEntity<>(HttpStatus.CONFLICT); } + if (!image.isEmpty() && !image.getContentType().startsWith("image")) { + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + lectureService.createLecture(userId, lectureCreateRequest, image); return new ResponseEntity<>(HttpStatus.CREATED); diff --git a/backend/src/main/java/com/edufocus/edufocus/quiz/controller/QuizController.java b/backend/src/main/java/com/edufocus/edufocus/quiz/controller/QuizController.java index b1e3fe5..4a874c9 100644 --- a/backend/src/main/java/com/edufocus/edufocus/quiz/controller/QuizController.java +++ b/backend/src/main/java/com/edufocus/edufocus/quiz/controller/QuizController.java @@ -38,6 +38,12 @@ public class QuizController { return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } + for (MultipartFile image : images) { + if (!image.isEmpty() && !image.getContentType().startsWith("image")) { + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + } + QuizSet quizSet = quizSetService.createQuizSet(userId, quizSetCreateRequest.getTitle()); int imageIdx = 0; @@ -81,6 +87,12 @@ public class QuizController { return new ResponseEntity<>(HttpStatus.CONFLICT); } + for (MultipartFile image : images) { + if (!image.isEmpty() && !image.getContentType().startsWith("image")) { + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + } + quizSetService.updateQuizSet(quizSetUpdateRequest.getId(), quizSetUpdateRequest.getTitle()); Map quizUpdatedCheckMap = new HashMap<>();