Skip to content

Commit 7ea85a9

Browse files
jhoellercbeams
authored andcommitted
Fix MultipartResolver Resin compatibility
StandardServletMultipartResolver#cleanupMultipart now takes care to delete only actual file parts for Resin compatibility. Issue: SPR-9299
1 parent 2c7d2f7 commit 7ea85a9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2011 the original author or authors.
2+
* Copyright 2002-2012 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -59,10 +59,13 @@ public MultipartHttpServletRequest resolveMultipart(HttpServletRequest request)
5959
}
6060

6161
public void cleanupMultipart(MultipartHttpServletRequest request) {
62-
// To be on the safe side: explicitly delete all parts.
62+
// To be on the safe side: explicitly delete the parts,
63+
// but only actual file parts (for Resin compatibility)
6364
try {
6465
for (Part part : request.getParts()) {
65-
part.delete();
66+
if (request.getFile(part.getName()) != null) {
67+
part.delete();
68+
}
6669
}
6770
}
6871
catch (Exception ex) {

0 commit comments

Comments
 (0)