From f5a871bfe89871dbdcf430ae8c81e46c15c1424a Mon Sep 17 00:00:00 2001 From: "Daniel F. Dickinson" Date: Sat, 5 Jan 2019 00:43:37 -0500 Subject: luci-base: Fix addr:port validate always fails In cbi.js there is an error which causes ipaddrport validation to always fail. JS match() return the entire match as ret[0] and individual matches (for multiple ()) as the subsequent list members. So we fix it by just fixing the index in the calls that want the individual parts. Signed-off-by: Daniel F. Dickinson --- modules/luci-base/htdocs/luci-static/resources/cbi.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js index f93c9351a..67ddc6af3 100644 --- a/modules/luci-base/htdocs/luci-static/resources/cbi.js +++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js @@ -443,10 +443,10 @@ var CBIValidatorPrototype = { m6 = this.value.match((bracket == 1) ? /^\[(.+)\]:(\d+)$/ : /^([^\[\]]+):(\d+)$/); if (m4) - return this.assert(this.apply('ip4addr', m4[0], [true]) && this.apply('port', m4[1]), + return this.assert(this.apply('ip4addr', m4[1], [true]) && this.apply('port', m4[2]), _('valid address:port')); - return this.assert(m6 && this.apply('ip6addr', m6[0], [true]) && this.apply('port', m6[1]), + return this.assert(m6 && this.apply('ip6addr', m6[1], [true]) && this.apply('port', m6[2]), _('valid address:port')); }, -- cgit v1.2.3