mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 01:03:35 +00:00
allow launching URLs without protocol than end with tld
This commit is contained in:
@@ -12,6 +12,7 @@ export class Utils {
|
||||
static isBrowser = true;
|
||||
static isMobileBrowser = false;
|
||||
static global: any = null;
|
||||
static tldEndingRegex = /.*\.(com|net|org|edu|uk|gov|ca|de|jp|fr|au|ru|ch|io|es|us|co|xyz|info|ly|mil)$/;
|
||||
|
||||
static init() {
|
||||
if (Utils.inited) {
|
||||
@@ -175,7 +176,13 @@ export class Utils {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (uriString.startsWith('http://') || uriString.startsWith('https://')) {
|
||||
let httpUrl = uriString.startsWith('http://') || uriString.startsWith('https://');
|
||||
if (!httpUrl && Utils.tldEndingRegex.test(uriString)) {
|
||||
uriString = 'http://' + uriString;
|
||||
httpUrl = true;
|
||||
}
|
||||
|
||||
if (httpUrl) {
|
||||
try {
|
||||
const url = Utils.getUrlObject(uriString);
|
||||
if (url.hostname === 'localhost' || Utils.validIpAddress(url.hostname)) {
|
||||
|
||||
Reference in New Issue
Block a user