From d19d3f5d49ec43af5437051982cd6dc20532e498 Mon Sep 17 00:00:00 2001 From: MangKyu Date: Tue, 1 Feb 2022 02:07:58 +0900 Subject: [PATCH] Fix FileImage --- .../interview/app/file/constants/FileConstants.java | 2 +- .../interview/app/file/controller/FileController.java | 5 +++++ src/main/resources/static/js/quiz/edit.js | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/mangkyu/employment/interview/app/file/constants/FileConstants.java b/src/main/java/com/mangkyu/employment/interview/app/file/constants/FileConstants.java index 1a73247..91dc88e 100644 --- a/src/main/java/com/mangkyu/employment/interview/app/file/constants/FileConstants.java +++ b/src/main/java/com/mangkyu/employment/interview/app/file/constants/FileConstants.java @@ -5,6 +5,6 @@ import lombok.NoArgsConstructor; @NoArgsConstructor public final class FileConstants { - public static final String FILE_API_PREFIX = "/file"; + public static final String FILE_API_PREFIX = "/api/file"; } diff --git a/src/main/java/com/mangkyu/employment/interview/app/file/controller/FileController.java b/src/main/java/com/mangkyu/employment/interview/app/file/controller/FileController.java index 2f7c1fb..2a7ea1f 100644 --- a/src/main/java/com/mangkyu/employment/interview/app/file/controller/FileController.java +++ b/src/main/java/com/mangkyu/employment/interview/app/file/controller/FileController.java @@ -23,6 +23,11 @@ public class FileController { } @GetMapping(FILE_API_PREFIX + "/{resourceId}") + public ResponseEntity getFileApi(@PathVariable String resourceId) { + return ResponseEntity.ok(fileService.getFileAsResource(resourceId)); + } + + @GetMapping("/file/{resourceId}") public ResponseEntity getFile(@PathVariable String resourceId) { return ResponseEntity.ok(fileService.getFileAsResource(resourceId)); } diff --git a/src/main/resources/static/js/quiz/edit.js b/src/main/resources/static/js/quiz/edit.js index 2821b58..3599f18 100644 --- a/src/main/resources/static/js/quiz/edit.js +++ b/src/main/resources/static/js/quiz/edit.js @@ -4,7 +4,7 @@ $(document).ready(function () { let editor ClassicEditor.create(document.querySelector('#editor'), { ckfinder: { - uploadUrl: '/file' + uploadUrl: '/api/file' }}).then(newEditor => { editor = newEditor; }).catch(error => {