Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Enhort
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Michael Menzel
Enhort
Commits
54a0a8ac
Commit
54a0a8ac
authored
Jun 04, 2019
by
Michael Menzel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed error redirect on file size too large
parent
8d9a360f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
frontend/src/main/java/de/thm/spring/controller/ApplicationController.java
.../java/de/thm/spring/controller/ApplicationController.java
+16
-2
frontend/src/main/resources/templates/error.html
frontend/src/main/resources/templates/error.html
+1
-1
No files found.
frontend/src/main/java/de/thm/spring/controller/ApplicationController.java
View file @
54a0a8ac
...
...
@@ -121,10 +121,24 @@ public class ApplicationController implements ErrorController {
@ExceptionHandler
(
MultipartException
.
class
)
String
handleFileException
(
HttpServletRequest
request
,
Throwable
ex
,
Model
model
)
{
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
(){
...
...
frontend/src/main/resources/templates/error.html
View file @
54a0a8ac
...
...
@@ -23,7 +23,7 @@
<a
href=
"/"
class=
"btn btn-outline-info"
>
back
</a>
<div
id=
"error"
class=
"bg-danger"
>
<h
4>
Something went wrong
</h4
>
<h
5>
Something went wrong:
</h5
>
<p
th:text=
"${errorCode}"
></p>
<p
th:text=
"${errorMessage}"
></p>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment