mirror of
https://github.com/openwrt/luci.git
synced 2026-04-15 19:01:56 +00:00
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:
@@ -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}`;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user