From 7ddfe6bbda71496217e3bc8b9d047ee132eda713 Mon Sep 17 00:00:00 2001 From: Maurizio Cucchiara Date: Mon, 3 Oct 2011 08:35:31 +0000 Subject: [PATCH] WW-3688 JavaScript URL validator in the FreeMarker template fails many valid URLs git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1178333 13f79535-47bb-0310-9956-ffa450edef68 --- core/src/main/resources/template/xhtml/form-close-validate.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/template/xhtml/form-close-validate.ftl b/core/src/main/resources/template/xhtml/form-close-validate.ftl index 8a780c44d..49d3a2314 100644 --- a/core/src/main/resources/template/xhtml/form-close-validate.ftl +++ b/core/src/main/resources/template/xhtml/form-close-validate.ftl @@ -91,7 +91,7 @@ END SNIPPET: supported-validators <#if validator.shortCircuit>continueValidation = false; } <#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;