You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2020/09/07 07:25:46 UTC
[struts] branch master updated: Empty file upload,
storeLocation null gives wrong error message.
This is an automated email from the ASF dual-hosted git repository.
lukaszlenart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/struts.git
The following commit(s) were added to refs/heads/master by this push:
new 23ddc8f Empty file upload, storeLocation null gives wrong error message.
new abb1c4d Merge pull request #435 from gregh3269/master
23ddc8f is described below
commit 23ddc8f02970d0bf6a3c6673728e3970eab4edc2
Author: Greg Huber <gh...@guestales.co.uk>
AuthorDate: Fri Sep 4 13:23:15 2020 +0100
Empty file upload, storeLocation null gives wrong error message.
---
.../org/apache/struts2/interceptor/FileUploadInterceptor.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java
index 3105b7d..bb77ea0 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java
@@ -345,6 +345,14 @@ public class FileUploadInterceptor extends AbstractInterceptor {
if (LOG.isWarnEnabled()) {
LOG.warn(errMsg);
}
+ } else if (file.getContent() == null) {
+ String errMsg = getTextMessage(action, "struts.messages.error.uploading", new String[]{filename});
+ if (validation != null) {
+ validation.addFieldError(inputName, errMsg);
+ }
+ if (LOG.isWarnEnabled()) {
+ LOG.warn(errMsg);
+ }
} else if (maximumSize != null && maximumSize < file.length()) {
String errMsg = getTextMessage(action, "struts.messages.error.file.too.large", new String[]{inputName, filename, file.getName(), "" + file.length(), getMaximumSizeStr(action)});
if (validation != null) {