mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
parse uri with Uri.TryCreate
This commit is contained in:
parent
8e5a01d82c
commit
375f23ac9e
1 changed files with 10 additions and 17 deletions
|
@ -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 a new issue