Skip to content

Commit

Permalink
Remove HTTP parts workaround for Resin
Browse files Browse the repository at this point in the history
A workaround was added for the Resin Servlet container in gh-13937.
This avoids attempting to delete parts that are not named, because the
`part.delete()` call would fail for non-file entries. This can be
problematic for files that are unnamed as they might not be removed by
the Framework.

This commit removes this workaround as Resin is not supported anymore.

Fixes gh-33511
  • Loading branch information
bclozel committed Oct 23, 2024
1 parent fb0a108 commit 4a81f2c
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -116,13 +116,10 @@ public MultipartHttpServletRequest resolveMultipart(HttpServletRequest request)
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) {
Expand Down

0 comments on commit 4a81f2c

Please sign in to comment.