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

Commit 3ffe834

Browse files
author
Jasmine
committed
add checks and properties to see if uri is from github
1 parent 8766df6 commit 3ffe834

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/GitHub.Exports/Primitives/UriString.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ void SetUri(Uri uri)
7777
}
7878

7979
IsHypertextTransferProtocol = uri.IsHypertextTransferProtocol();
80+
IsGithubUri = uri.IsGithubUri();
8081
}
8182

8283
void SetFilePath(Uri uri)

src/GitHub.Extensions/UriExtensions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ public static bool IsHypertextTransferProtocol(this Uri uri)
2525
return uri.Scheme == "http" || uri.Scheme == "https";
2626
}
2727

28+
public static bool IsGithubUri(this Uri uri)
29+
{
30+
return uri.OriginalString.Contains("github.com");
31+
}
32+
2833
public static bool IsSameHost(this Uri uri, Uri compareUri)
2934
{
3035
return uri.Host.Equals(compareUri.Host, StringComparison.OrdinalIgnoreCase);

src/GitHub.VisualStudio/Base/MenuBase.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ void RefreshRepo()
4444
protected bool IsGitHubRepo()
4545
{
4646
RefreshRepo();
47-
return ActiveRepo?.CloneUrl?.RepositoryName != null;
47+
return ActiveRepo?.CloneUrl?.RepositoryName != null && ActiveRepo?.CloneUrl?.IsGithubUri == true;
48+
4849
}
4950
}
5051
}

0 commit comments

Comments
 (0)