From 11dcb4f6365c4ee248bf3841c4506d92f89b324d Mon Sep 17 00:00:00 2001 From: Linkle123 <102257641+Linkle123@users.noreply.github.com> Date: Sun, 17 Dec 2023 22:34:03 +0900 Subject: [PATCH] Update FileUploadController.java There was no parameter in the PathVariable, so serveFile wasn't getting filename correctly. localhost doesn't display correct link to click without this fix. --- .../java/com/example/uploadingfiles/FileUploadController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/complete/src/main/java/com/example/uploadingfiles/FileUploadController.java b/complete/src/main/java/com/example/uploadingfiles/FileUploadController.java index a529b69..e5408fe 100644 --- a/complete/src/main/java/com/example/uploadingfiles/FileUploadController.java +++ b/complete/src/main/java/com/example/uploadingfiles/FileUploadController.java @@ -45,7 +45,7 @@ public String listUploadedFiles(Model model) throws IOException { @GetMapping("/files/{filename:.+}") @ResponseBody - public ResponseEntity serveFile(@PathVariable String filename) { + public ResponseEntity serveFile(@PathVariable("filename") String filename) { Resource file = storageService.loadAsResource(filename);