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>
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}`;
},
/**