Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 7cfd1a1

Browse files
committed
🔥 Remove the ToHttps method
We no longer need this.
1 parent 675c82c commit 7cfd1a1

File tree

2 files changed

+0
-45
lines changed

2 files changed

+0
-45
lines changed

src/GitHub.Extensions/UriExtensions.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -38,30 +38,6 @@ public static Uri WithAbsolutePath(this Uri uri, string absolutePath)
3838
return new Uri(uri, new Uri(absolutePath, UriKind.Relative));
3939
}
4040

41-
[return: AllowNull]
42-
public static Uri ToHttps([AllowNull] this Uri uri)
43-
{
44-
if (uri == null)
45-
return null;
46-
47-
var str = uri.ToString();
48-
if (str.EndsWith(".git", StringComparison.Ordinal))
49-
str = str.Remove(str.Length - 4);
50-
51-
if (str.StartsWith("[email protected]:", StringComparison.Ordinal))
52-
str = str.Replace("[email protected]:", "https://github.com/");
53-
54-
if (!Uri.TryCreate(str, UriKind.Absolute, out uri))
55-
return null;
56-
57-
var uriBuilder = new UriBuilder(uri);
58-
59-
uriBuilder.Scheme = Uri.UriSchemeHttps;
60-
// trick to keep uriBuilder from explicitly appending :80 to the HTTPS URI
61-
uriBuilder.Port = -1;
62-
return uriBuilder.Uri;
63-
}
64-
6541
public static string ToUpperInvariantString(this Uri uri)
6642
{
6743
return uri == null ? "" : uri.ToString().ToUpperInvariant();
Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
using System;
2-
using GitHub.Services;
3-
using Microsoft.TeamFoundation.Git.Controls.Extensibility;
4-
using NSubstitute;
52
using Xunit;
63
using GitHub.Extensions;
74

@@ -28,22 +25,4 @@ public void OnlyParsesUrlsWithThreeParts(string uri, string expected)
2825
Assert.Equal(new Uri(uri).GetRepo(), expected);
2926
}
3027
}
31-
32-
public class TheHttpsMethod : TestBaseClass
33-
{
34-
[Theory]
35-
[InlineData(null, null)]
36-
[InlineData("", null)]
37-
[InlineData("[email protected]:bla/test.git", "https://github.com/bla/test")]
38-
[InlineData("git://github.com/bla/test.git", "https://github.com/bla/test")]
39-
public void CreatesHttpsUrl(string uri, string expected)
40-
{
41-
Uri value = null;
42-
Uri.TryCreate(uri, UriKind.RelativeOrAbsolute, out value);
43-
44-
var ret = value.ToHttps();
45-
var ret2 = ret != null ? ret.ToString() : null;
46-
Assert.Equal(expected, ret2);
47-
}
48-
}
4928
}

0 commit comments

Comments
 (0)