Switch to literal regexp notation, fix url validation
Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/fb896b6c Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/fb896b6c Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/fb896b6c Branch: refs/heads/master Commit: fb896b6c1cc599c70954cea1ca2dac6c60b8961a Parents: 907ce98 Author: Lukasz Racon <[email protected]> Authored: Thu Nov 12 09:29:47 2015 -0600 Committer: Lukasz Racon <[email protected]> Committed: Thu Nov 12 09:29:47 2015 -0600 ---------------------------------------------------------------------- core/src/main/resources/template/xhtml/form-close-validate.ftl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/fb896b6c/core/src/main/resources/template/xhtml/form-close-validate.ftl ---------------------------------------------------------------------- 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 1c8c629..e8dd991 100644 --- a/core/src/main/resources/template/xhtml/form-close-validate.ftl +++ b/core/src/main/resources/template/xhtml/form-close-validate.ftl @@ -114,13 +114,13 @@ END SNIPPET: supported-validators <#if validator.shortCircuit>continueValidation = false;</#if> } <#elseif validator.validatorType = "email"> - if (continueValidation && fieldValue != null && fieldValue.length > 0 && fieldValue.match(new RegExp("${validator.regex?js_string}", "i"))==null) { + if (continueValidation && fieldValue != null && fieldValue.length > 0 && fieldValue.match(/${validator.regex}/i)==null) { addError(field, error); errors = true; <#if validator.shortCircuit>continueValidation = false;</#if> } <#elseif validator.validatorType = "url"> - if (continueValidation && fieldValue != null && fieldValue.length > 0 && fieldValue.match("/${validator.urlRegex?js_string}/i")==null) { + if (continueValidation && fieldValue != null && fieldValue.length > 0 && fieldValue.match(/${validator.urlRegex}/i)==null) { addError(field, error); errors = true; <#if validator.shortCircuit>continueValidation = false;</#if>
