Commit 54a0a8ac authored by Michael Menzel's avatar Michael Menzel

fixed error redirect on file size too large

parent 8d9a360f
......@@ -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(){
......
......@@ -23,7 +23,7 @@
<a href="/" class="btn btn-outline-info">back</a>
<div id="error" class="bg-danger">
<h4>Something went wrong</h4>
<h5>Something went wrong:</h5>
<p th:text="${errorCode}"></p>
<p th:text="${errorMessage}"></p>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment