luci-base: validation.js: fix xgettext quirk
authorJo-Philipp Wich <jo@mein.io>
Mon, 3 Apr 2023 12:05:00 +0000 (14:05 +0200)
committerJo-Philipp Wich <jo@mein.io>
Mon, 3 Apr 2023 12:05:00 +0000 (14:05 +0200)
The xgettext utility does not properly discard `/` inside regex character
classes, causing a false positive unterminated string error.

Avoid the issue by explicitly escaping the embedded slash.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/validation.js

index b7a3a140e4c54b1a4f23dd78af8d547c9204a9d6..791a84823d4c1ec49157bb22e6165bdc01842d81 100644 (file)
@@ -432,7 +432,7 @@ var ValidatorFactory = baseclass.extend({
                        if (v == '.' || v == '..')
                                return this.assert(false, _('valid network device name, not "." or ".."'));
 
-                       return this.assert(v.match(/^[^:/%\s]{1,15}$/), _('valid network device name between 1 and 15 characters not containing ":", "/", "%" or spaces'));
+                       return this.assert(v.match(/^[^:\/%\s]{1,15}$/), _('valid network device name between 1 and 15 characters not containing ":", "/", "%" or spaces'));
                },
 
                range: function(min, max) {