diff --git a/frontend/src/main/java/de/thm/spring/controller/ApplicationController.java b/frontend/src/main/java/de/thm/spring/controller/ApplicationController.java index 15e7b711c182a0720d7be40bdcb7181dbd154a56..f400a46c2ed9fa2d3a21da0a02b21b3900166050 100644 --- a/frontend/src/main/java/de/thm/spring/controller/ApplicationController.java +++ b/frontend/src/main/java/de/thm/spring/controller/ApplicationController.java @@ -121,11 +121,25 @@ public class ApplicationController implements ErrorController { @ExceptionHandler(MultipartException.class) String handleFileException(HttpServletRequest request, Throwable ex, Model model) { - model.addAttribute("errorMessage", "The file you tried to upload is too large. Please upload only files with a max. file size of 20 MB."); - return "error"; + + return "redirect:/filesizetoolarge"; } } + /** + * File exceptions are redirected to this method to call 'error' with in a post request with the message + * + * @param model - same as always + * @return the error page + */ + @RequestMapping("/filesizetoolarge") + public String filesizetoolarge(Model model){ + + model.addAttribute("errorMessage", "The file you tried to upload is too large. Please upload only files with a max. file size of 20 MB."); + + return "error"; + } + @RequestMapping("/faq") public String faq(){ diff --git a/frontend/src/main/resources/templates/error.html b/frontend/src/main/resources/templates/error.html index c2c84b4a7e1d6f0e5fb54f411cba61b347f54b6e..07bd2f505de72bb7c9c9075dbee14330384c14e1 100644 --- a/frontend/src/main/resources/templates/error.html +++ b/frontend/src/main/resources/templates/error.html @@ -23,7 +23,7 @@ back
-

Something went wrong

+
Something went wrong: