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

Commit 56add34

Browse files
committed
Make sure we don't crash with file remote origin
1 parent 5a01995 commit 56add34

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/GitHub.Exports/Primitives/UriString.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ bool ParseScpSyntax(string scpString)
125125
/// <returns></returns>
126126
public Uri ToRepositoryUrl()
127127
{
128+
if (url != null && IsFileUri) return url;
129+
128130
var scheme = url != null && IsHypertextTransferProtocol
129131
? url.Scheme
130132
: Uri.UriSchemeHttps;

src/UnitTests/GitHub.Primitives/UriStringTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ public void ReturnWhetherTheUriIsParseableByUri(string uriString, bool expected)
162162
public class TheToRepositoryUrlMethod
163163
{
164164
[Theory]
165+
[InlineData("file:///C:/dev/exp/foo", "file:///C:/dev/exp/foo")]
165166
[InlineData("http://example.com/", "http://example.com/")]
166167
[InlineData("http://[email protected]/foo/bar", "http://example.com/foo/bar")]
167168
[InlineData("https://github.com/github/Windows", "https://github.com/github/Windows")]

0 commit comments

Comments
 (0)