myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [myfaces-tobago] 05/10: (TOBAGO-407) tc:validateFileItem forces required="true"
Date Sat, 16 Sep 2017 05:46:37 GMT
This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to tag tobago-1.0.11
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit 83eb41ce83f83b7c688c65feafc0a1e63934d9ad
Author: Bernd Bohmann <bommel@apache.org>
AuthorDate: Wed May 23 20:34:30 2007 +0000

    (TOBAGO-407) tc:validateFileItem forces required="true"
---
 .../java/org/apache/myfaces/tobago/validator/FileItemValidator.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/myfaces/tobago/validator/FileItemValidator.java
b/core/src/main/java/org/apache/myfaces/tobago/validator/FileItemValidator.java
index 2dc6174..4541318 100644
--- a/core/src/main/java/org/apache/myfaces/tobago/validator/FileItemValidator.java
+++ b/core/src/main/java/org/apache/myfaces/tobago/validator/FileItemValidator.java
@@ -60,7 +60,8 @@ public class FileItemValidator implements Validator, StateHolder {
             DoubleRangeValidator.MAXIMUM_MESSAGE_ID, FacesMessage.SEVERITY_ERROR, args);
         throw new ValidatorException(facesMessage);
       }
-      if (contentType != null
+      // Check only a valid file
+      if (file.getSize() > 0 && contentType != null
           && !ContentType.valueOf(contentType).match(ContentType.valueOf(file.getContentType())))
{
         // TODO i18n
         String text = "ContentType " + file.getContentType() + " not expected.";

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <commits@myfaces.apache.org>.

Mime
View raw message