Skip to content

Commit 10838a6

Browse files
kacperkrzyzaksbrannen
authored andcommitted
Correctly identify MaxUploadSizeExceededException in StandardMultipartHttpServletRequest
This commit correctly identifies MaxUploadSizeExceededException in StandardMultipartHttpServletRequest by converting keywords in the exception message to lowercase before checking for their presence, for compatibility with Jetty 9.4.x. Closes gh-28759
1 parent 3c3ae32 commit 10838a6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

spring-web/src/main/java/org/springframework/web/multipart/support/StandardMultipartHttpServletRequest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,11 @@ private void parseRequest(HttpServletRequest request) {
118118

119119
protected void handleParseFailure(Throwable ex) {
120120
String msg = ex.getMessage();
121-
if (msg != null && msg.contains("size") && msg.contains("exceed")) {
122-
throw new MaxUploadSizeExceededException(-1, ex);
121+
if (msg != null) {
122+
msg = msg.toLowerCase();
123+
if (msg.contains("size") && msg.contains("exceed")) {
124+
throw new MaxUploadSizeExceededException(-1, ex);
125+
}
123126
}
124127
throw new MultipartException("Failed to parse multipart servlet request", ex);
125128
}

0 commit comments

Comments
 (0)