diff --git a/spring-web/src/main/java/org/springframework/web/multipart/support/StandardServletMultipartResolver.java b/spring-web/src/main/java/org/springframework/web/multipart/support/StandardServletMultipartResolver.java index 29c79b7a813..92b3c78d5f8 100644 --- a/spring-web/src/main/java/org/springframework/web/multipart/support/StandardServletMultipartResolver.java +++ b/spring-web/src/main/java/org/springframework/web/multipart/support/StandardServletMultipartResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -116,13 +116,10 @@ public class StandardServletMultipartResolver implements MultipartResolver { public void cleanupMultipart(MultipartHttpServletRequest request) { if (!(request instanceof AbstractMultipartHttpServletRequest abstractMultipartHttpServletRequest) || abstractMultipartHttpServletRequest.isResolved()) { - // To be on the safe side: explicitly delete the parts, - // but only actual file parts (for Resin compatibility) + try { for (Part part : request.getParts()) { - if (request.getFile(part.getName()) != null) { - part.delete(); - } + part.delete(); } } catch (Throwable ex) {