From eef9588646091d268ef4c94f3d6db1412d9a99ab Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 1 Jun 2020 14:31:42 -0400 Subject: [PATCH] check for empty string on malformed URL (#108) --- src/misc/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/misc/utils.ts b/src/misc/utils.ts index 5c86ccd94c..e0b7041356 100644 --- a/src/misc/utils.ts +++ b/src/misc/utils.ts @@ -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; }