mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
check for empty string on malformed URL (#108)
This commit is contained in:
@@ -157,7 +157,7 @@ export class Utils {
|
|||||||
static getHostname(uriString: string): string {
|
static getHostname(uriString: string): string {
|
||||||
const url = Utils.getUrl(uriString);
|
const url = Utils.getUrl(uriString);
|
||||||
try {
|
try {
|
||||||
return url != null ? url.hostname : null;
|
return url != null && url.hostname !== '' ? url.hostname : null;
|
||||||
} catch {
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ export class Utils {
|
|||||||
static getHost(uriString: string): string {
|
static getHost(uriString: string): string {
|
||||||
const url = Utils.getUrl(uriString);
|
const url = Utils.getUrl(uriString);
|
||||||
try {
|
try {
|
||||||
return url != null ? url.host : null;
|
return url != null && url.host !== '' ? url.host : null;
|
||||||
} catch {
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user