luci-base: allow terminal '.' in hostname checks
authorPaul Donald <newtwen+github@gmail.com>
Tue, 22 Oct 2024 20:33:00 +0000 (22:33 +0200)
committerPaul Donald <newtwen+github@gmail.com>
Tue, 22 Oct 2024 21:48:38 +0000 (23:48 +0200)
allowed in hostnames to represent the root of the DNS hierarchy

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
modules/luci-base/htdocs/luci-static/resources/validation.js

index 5719031cb7475dde4b1a73def0602c46ece0949e..87f5f4b42c1c2efefbc98808110ab2e0c4caf1d5 100644 (file)
@@ -394,7 +394,7 @@ var ValidatorFactory = baseclass.extend({
                        if (this.value.length <= 253)
                                return this.assert(
                                        (this.value.match(/^[a-zA-Z0-9_]+$/) != null ||
-                                               (this.value.match(/^[a-zA-Z0-9_][a-zA-Z0-9_\-.]*[a-zA-Z0-9]$/) &&
+                                               (this.value.match(/^[a-zA-Z0-9_][a-zA-Z0-9_\-.]*[a-zA-Z0-9]\.?$/) &&
                                                 this.value.match(/[^0-9.]/))) &&
                                        (!strict || !this.value.match(/^_/)),
                                        _('valid hostname'));