Merge branch '6.1.x'

This commit is contained in:
Brian Clozel 2024-10-23 09:26:40 +02:00
commit 1ba773170d
1 changed files with 3 additions and 6 deletions

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -116,15 +116,12 @@ public class StandardServletMultipartResolver implements MultipartResolver {
public void cleanupMultipart(MultipartHttpServletRequest request) { public void cleanupMultipart(MultipartHttpServletRequest request) {
if (!(request instanceof AbstractMultipartHttpServletRequest abstractMultipartHttpServletRequest) || if (!(request instanceof AbstractMultipartHttpServletRequest abstractMultipartHttpServletRequest) ||
abstractMultipartHttpServletRequest.isResolved()) { abstractMultipartHttpServletRequest.isResolved()) {
// To be on the safe side: explicitly delete the parts,
// but only actual file parts (for Resin compatibility)
try { try {
for (Part part : request.getParts()) { for (Part part : request.getParts()) {
if (request.getFile(part.getName()) != null) {
part.delete(); part.delete();
} }
} }
}
catch (Throwable ex) { catch (Throwable ex) {
LogFactory.getLog(getClass()).warn("Failed to perform cleanup of multipart items", ex); LogFactory.getLog(getClass()).warn("Failed to perform cleanup of multipart items", ex);
} }