Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Duplicate
-
2.5.26
Description
After upgrading to 2.5.26, uploading an empty file now ends with: "Error uploading: empty_file.txt"
This was working fine with Struts 2.5.20
Seems the behavior change occurred somewhere in 2.5.22 - 2.5.5.25
In org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest:
protected DiskFileItemFactory createDiskFileItemFactory(String saveDir) { DiskFileItemFactory fac = new DiskFileItemFactory(); // Make sure that the data is written to file fac.setSizeThreshold(0); if (saveDir != null) { fac.setRepository(new File(saveDir)); } return fac; }
For an empty file, seeing org.apache.commons.io.output.ThresholdingOutputStream checking threshold with an "greater than" operator (>),
I guess "fac.setSizeThreshold(0);" does not actually make sure the data is written to a file (hence getting null storeLocation)
Attachments
Issue Links
- duplicates
-
WW-5088 Empty file upload gives wrong error message
- Closed