Release 4.2 added support for per-file size limits — task #17792.
The new method is CommonsFileUploadSupport.setMaxUploadSizePerFile(long).
But this setting has no effect if file encoding does not match default encoding.
The reason is the following code in CommonsFileUploadSupport:
protectedFileUploadprepareFileUpload(Stringencoding) {
FileUploadfileUpload = getFileUpload();
FileUploadactualFileUpload = fileUpload;
// Use new temporary FileUpload instance if the request specifies// its own encoding that does not match the default encoding.if (encoding != null && !encoding.equals(fileUpload.getHeaderEncoding())) {
actualFileUpload = newFileUpload(getFileItemFactory());
actualFileUpload.setSizeMax(fileUpload.getSizeMax());
// !!missing: actualFileUpload.setFileSizeMax(fileUpload.getFileSizeMax());actualFileUpload.setHeaderEncoding(encoding);
}
returnactualFileUpload;
}
Affects: 4.2.2
Issue Links:
#17792 CommonsMultipartResolver should support setFileSizeMax
#19204 CommonsMultipartResolver should explicitly convert FileSizeLimitExceededException next to SizeLimitExceededException
Alex Shesterov opened SPR-13653 and commented
Release 4.2 added support for per-file size limits — task #17792.
The new method is
CommonsFileUploadSupport.setMaxUploadSizePerFile(long)
.But this setting has no effect if file encoding does not match default encoding.
The reason is the following code in
CommonsFileUploadSupport
:Affects: 4.2.2
Issue Links:
Referenced from: commits a1bf941
The text was updated successfully, but these errors were encountered: