Author: michiel Date: 2010-03-02 17:58:45 +0100 (Tue, 02 Mar 2010) New Revision: 41242
Modified: mmbase/trunk/bridge/src/main/java/org/mmbase/datatypes/BinaryDataType.java Log: as long as the mimetype is 'undetermined' we consider it valid. Needed for client-side checking. Some clients, are not doing it very well Modified: mmbase/trunk/bridge/src/main/java/org/mmbase/datatypes/BinaryDataType.java =================================================================== --- mmbase/trunk/bridge/src/main/java/org/mmbase/datatypes/BinaryDataType.java 2010-03-02 16:58:20 UTC (rev 41241) +++ mmbase/trunk/bridge/src/main/java/org/mmbase/datatypes/BinaryDataType.java 2010-03-02 16:58:45 UTC (rev 41242) @@ -101,7 +101,9 @@ * @since MMBase-1.9.3 */ public MimeType getMimeType(Object value, Node node, Field field) { - if (value == null) return MimeType.OCTETSTREAM; + if (value == null) { + return MimeType.OCTETSTREAM; + } String mt; if (value instanceof byte[]) { byte[] array = (byte[]) value; @@ -116,7 +118,7 @@ mt = Casting.toSerializableInputStream(value).getContentType(); } if (mt == null || mt.equals(MagicFile.FAILED)) { - return MimeType.OCTETSTREAM; + return MimeType.UNDETERMINED; } else { return new MimeType(mt); } @@ -147,7 +149,7 @@ } /** - * @since MMBase-2.0 + * @since MMBase-1.9.3 */ protected class MimeTypeRestriction extends AbstractRestriction<Pattern> { private static final long serialVersionUID = 0L; @@ -165,6 +167,10 @@ return true; } MimeType s = BinaryDataType.this.getMimeType(v, node, field); + if (MimeType.UNDETERMINED.equals(s)) { + log.debug("The mime type could not be determined. Giving the benefit of the doubt."); + return true; + } boolean res = s == null ? false : value.matcher(s.toString()).matches(); if (log.isDebugEnabled()) { log.debug("VALIDATING " + v + "->" + s + " with " + getValue() + " -> " + res); _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs