1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-09-06 00:48:08 +02:00

check for empty string on malformed URL (#108)

This commit is contained in:
Kyle Spearrin 2020-06-01 14:31:42 -04:00 committed by Hinton
parent 17298cf188
commit d1e4eebebb

View File

@ -157,7 +157,7 @@ export class Utils {
static getHostname(uriString: string): string {
const url = Utils.getUrl(uriString);
try {
return url != null ? url.hostname : null;
return url != null && url.hostname !== '' ? url.hostname : null;
} catch {
return null;
}
@ -166,7 +166,7 @@ export class Utils {
static getHost(uriString: string): string {
const url = Utils.getUrl(uriString);
try {
return url != null ? url.host : null;
return url != null && url.host !== '' ? url.host : null;
} catch {
return null;
}