treewide: escape slash chars in regex strings in .js files

Properly escape the slash '/' chars that are included in the regex
strings in javascript files. Slash is used as a regex delimiter in
javascript, so an un-escaped slash may cause parsing errors in some
tools like xgettext used with .po translation manipulation.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
This commit is contained in:
Hannu Nyman committed 2026-06-25 23:14:58 +03:00
1 parent 51f47b4406
commit c653c94a02
5 files changed
+6 -6

No files matched your search

@@ -44,7 +44,7 @@ function validateCert(priv, section_id, value) {
const beg = priv ? /^-----BEGIN (RSA )?PRIVATE KEY-----$/ : /^-----BEGIN CERTIFICATE-----$/;
const end = priv ? /^-----END (RSA )?PRIVATE KEY-----$/ : /^-----END CERTIFICATE-----$/;
const lines = value.trim().split(/[\r\n]/);
const base64 = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
const base64 = /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/;
const errmsg = _('This does not look like a valid PEM file');
@@ -48,7 +48,7 @@ function validateCert(priv, section_id, value) {
for (i = 0; i < lines.length; i++) {
if (lines[i].match(/^-{5}BEGIN ((|RSA |DSA )PRIVATE KEY|(|TRUSTED |X509 )CERTIFICATE)-{5}$/))
start = true;
else if (start && !lines[i].match(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/))
else if (start && !lines[i].match(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/))
break;
}