mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-26 12:16:07 +01:00
parse uri with Uri.TryCreate
This commit is contained in:
parent
8e5a01d82c
commit
375f23ac9e
@ -126,26 +126,19 @@ namespace Bit.App.Models.Page
|
||||
return _uriHost;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var host = new Uri(Uri).Host;
|
||||
|
||||
DomainName domain;
|
||||
if(DomainName.TryParse(host, out domain))
|
||||
{
|
||||
_uriHost = domain.BaseDomain;
|
||||
}
|
||||
else
|
||||
{
|
||||
_uriHost = host;
|
||||
}
|
||||
|
||||
return _uriHost;
|
||||
}
|
||||
catch
|
||||
Uri uri;
|
||||
if(!System.Uri.TryCreate(Uri, UriKind.Absolute, out uri))
|
||||
{
|
||||
return Uri;
|
||||
}
|
||||
|
||||
DomainName domain;
|
||||
if(DomainName.TryParse(uri.Host, out domain))
|
||||
{
|
||||
return domain.BaseDomain;
|
||||
}
|
||||
|
||||
return uri.Host;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user