1
0
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:
Kyle Spearrin 2017-02-25 22:03:18 -05:00
parent 8e5a01d82c
commit 375f23ac9e

View File

@ -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;
}
}