mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
fix: IcdUriBuilder better handles strings without scheme info
This commit is contained in:
parent
6b8fc19eb3
commit
2a25c3d733
1 changed files with 5 additions and 2 deletions
|
|
@ -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(':');
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue