You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2017/09/16 05:46:37 UTC

[myfaces-tobago] 05/10: (TOBAGO-407) tc:validateFileItem forces required="true"

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 <bo...@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" <co...@myfaces.apache.org>.