luci-app-dockerman: jsmin workaround

jsmin state machine is basic so it fails on this:

return /^https?:\/\//i.test(addr)

interpreting the final // as comment start, not recognizing
it is in a regex. But if we wrap the regex in () then all
is well. jsmin has the comment:

action recognizes a regular expression if it is preceded by the likes of
'(' or ',' or '='.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
This commit is contained in:
Paul Donald
2026-02-05 18:06:43 +01:00
parent aba4fd8a90
commit f0ff5612a1

View File

@@ -742,7 +742,10 @@ const dv = view.extend({
ensureRegistryScheme(address, hostFallback) {
const addr = String(address || '').trim() || hostFallback;
if (!addr) return null;
return /^https?:\/\//i.test(addr) ? addr : `https://${addr}`;
/* jsmin cannot handle /^https?:\/\//i.test(addr) - wrap in parentheses: OK
https = new RegExp('https?:\/\/', 'i'); // also OK
*/
return (/^https?:\/\//i.test(addr)) ? addr : `https://${addr}`;
},
/**