Author: mcucchiara
Date: Mon Oct  3 08:35:31 2011
New Revision: 1178333

URL: http://svn.apache.org/viewvc?rev=1178333&view=rev
Log:
WW-3688 JavaScript URL validator in the FreeMarker template fails many valid 
URLs

Modified:
    
struts/struts2/trunk/core/src/main/resources/template/xhtml/form-close-validate.ftl

Modified: 
struts/struts2/trunk/core/src/main/resources/template/xhtml/form-close-validate.ftl
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/xhtml/form-close-validate.ftl?rev=1178333&r1=1178332&r2=1178333&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/main/resources/template/xhtml/form-close-validate.ftl
 (original)
+++ 
struts/struts2/trunk/core/src/main/resources/template/xhtml/form-close-validate.ftl
 Mon Oct  3 08:35:31 2011
@@ -91,7 +91,7 @@ END SNIPPET: supported-validators
                 <#if validator.shortCircuit>continueValidation = false;</#if>
             }
             <#elseif validator.validatorType = "url">
-            if (continueValidation && field.value != null && 
field.value.length > 0 && 
field.value.match(/(^(ftp|http|https):\/\/(\.[_A-Za-z0-9-]+)*(@?([A-Za-z0-9-])+)?(\.[A-Za-z0-9-]+)*((\.[A-Za-z0-9]{2,})|(\.[A-Za-z0-9]{2,}\.[A-Za-z0-9]{2,}))(:[0-9]+)?([/A-Za-z0-9?#_-]*)?$)/gi)==null)
 {
+            if (continueValidation && field.value != null && 
field.value.length > 0 && 
field.value.match(/^(ftp|http|https):\/\/((%[A-F0-9]{2}|[A-Z0-9-._~!$&'()*+,;=:])+@)?((%[A-F0-9]{2}|[A-Z0-9-._~!$&'()*+,;=])+)(:[0-9]+)?((\/(%[A-F0-9]{2}|[A-Z0-9-._~!$&'()*+,;=:@])*)*)(\?(%[A-F0-9]{2}|[A-Z0-9-._~!$&'()*+,;=:@/?])*)?(#(%[A-F0-9]{2}|[A-Z0-9-._~!$&'()*+,;=:@/?])*)?$/gi)==null)
 {
                 addError(field, error);
                 errors = true;
                 <#if validator.shortCircuit>continueValidation = false;</#if>


Reply via email to