mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 05:05:05 +00:00
fix: IcdUriBuilder better handles strings without scheme info
This commit is contained in:
@@ -70,7 +70,7 @@ namespace ICD.Common.Utils
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="uri"></param>
|
/// <param name="uri"></param>
|
||||||
public IcdUriBuilder(string uri)
|
public IcdUriBuilder(string uri)
|
||||||
: this(new Uri(uri))
|
: this(new Uri(uri, UriKind.RelativeOrAbsolute))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,6 +80,9 @@ namespace ICD.Common.Utils
|
|||||||
/// <param name="uri"></param>
|
/// <param name="uri"></param>
|
||||||
public IcdUriBuilder(Uri uri)
|
public IcdUriBuilder(Uri uri)
|
||||||
{
|
{
|
||||||
|
if (!uri.IsAbsoluteUri)
|
||||||
|
uri = new Uri(Uri.UriSchemeHttp + Uri.SchemeDelimiter + uri);
|
||||||
|
|
||||||
Fragment = uri.Fragment;
|
Fragment = uri.Fragment;
|
||||||
Host = uri.Host;
|
Host = uri.Host;
|
||||||
Password = uri.GetPassword();
|
Password = uri.GetPassword();
|
||||||
@@ -103,7 +106,7 @@ namespace ICD.Common.Utils
|
|||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
// Scheme
|
// Scheme
|
||||||
string scheme = string.IsNullOrEmpty(Scheme) ? "http" : Scheme;
|
string scheme = string.IsNullOrEmpty(Scheme) ? Uri.UriSchemeHttp : Scheme;
|
||||||
builder.Append(scheme);
|
builder.Append(scheme);
|
||||||
builder.Append(':');
|
builder.Append(':');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user