kusalk commented on code in PR #1365:
URL: https://github.com/apache/struts/pull/1365#discussion_r2386401638
##########
core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java:
##########
@@ -291,7 +291,7 @@ protected void cleanUpDiskFileItems() {
if (LOG.isDebugEnabled()) {
LOG.debug("Cleaning up disk item: {} at {}",
normalizeSpace(item.getFieldName()), itemPath);
}
- if (!Files.deleteIfExists(itemPath)) {
+ if (Files.exists(itemPath) &&
!Files.deleteIfExists(itemPath)) {
Review Comment:
This expression will never evaluate to `true` and log the below warning.
`Files#deleteIfExists` only returns `false` if the file doesn't exist. If we
want to determine when there was an issue deleting the file, then I believe we
need to catch `IOException` instead
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]