mirror of
https://github.com/bitwarden/mobile.git
synced 2024-12-27 17:08:00 +01:00
check for empty string on malformed URL (#944)
* treat empty string host as null * use `string.IsNullOrEmpty`
This commit is contained in:
parent
f8c7285f56
commit
24547e67bf
@ -36,13 +36,14 @@ namespace Bit.Core.Utilities
|
||||
|
||||
public static string GetHostname(string uriString)
|
||||
{
|
||||
return GetUri(uriString)?.Host;
|
||||
var uri = GetUri(uriString);
|
||||
return string.IsNullOrEmpty(uri?.Host) ? null : uri.Host;
|
||||
}
|
||||
|
||||
public static string GetHost(string uriString)
|
||||
{
|
||||
var uri = GetUri(uriString);
|
||||
if (uri != null)
|
||||
if (!string.IsNullOrEmpty(uri?.Host))
|
||||
{
|
||||
if (uri.IsDefaultPort)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user