Additional uri parsing intelligence (#861)

This commit is contained in:
Matt Portune 2020-04-29 13:09:46 -04:00 committed by GitHub
parent 69e0906491
commit 9d27f111bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View file

@ -164,9 +164,13 @@ namespace Bit.Droid.Accessibility
{ {
return uri; return uri;
} }
if (Uri.TryCreate("http://" + uri, UriKind.Absolute, out var uri3)) var hasHttpProtocol = uri.StartsWith("http://") || uri.StartsWith("https://");
if (!hasHttpProtocol && uri.Contains("."))
{ {
return string.Concat("http://", uri); if (Uri.TryCreate("http://" + uri, UriKind.Absolute, out var uri3))
{
return string.Concat("http://", uri);
}
} }
} }
return uri; return uri;

View file

@ -89,9 +89,13 @@ namespace Bit.Core.Utilities
{ {
return uri; return uri;
} }
if (Uri.TryCreate("http://" + uriString, UriKind.Absolute, out var uri2)) var hasHttpProtocol = uriString.StartsWith("http://") || uriString.StartsWith("https://");
if (!hasHttpProtocol && uriString.Contains("."))
{ {
return uri2; if (Uri.TryCreate("http://" + uriString, UriKind.Absolute, out var uri2))
{
return uri2;
}
} }
return null; return null;
} }