[
https://issues.apache.org/jira/browse/WW-5573?focusedWorklogId=984929&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-984929
]
ASF GitHub Bot logged work on WW-5573:
--------------------------------------
Author: ASF GitHub Bot
Created on: 29/Sep/25 06:22
Start Date: 29/Sep/25 06:22
Worklog Time Spent: 10m
Work Description: lukaszlenart commented on code in PR #1365:
URL: https://github.com/apache/struts/pull/1365#discussion_r2386824856
##########
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:
Thanks, you are right, added a dedicated `deleteFile()` method with handling
IO exception
Issue Time Tracking
-------------------
Worklog Id: (was: 984929)
Time Spent: 40m (was: 0.5h)
> Avoid false positive warning if file doesn't exist
> --------------------------------------------------
>
> Key: WW-5573
> URL: https://issues.apache.org/jira/browse/WW-5573
> Project: Struts 2
> Issue Type: Improvement
> Components: Core
> Reporter: Lukasz Lenart
> Assignee: Lukasz Lenart
> Priority: Minor
> Fix For: 7.1.1
>
> Time Spent: 40m
> Remaining Estimate: 0h
>
> If files was already removed, cleanup logic in file upload mechanism
> shouldn't show a warning about not being able to delete the file:
> {noformat}
> There was a problem attempting to delete uploaded file: xxx{noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)