Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit c7c9a15

Browse files
Correcting usage of WebUri and ApiUri
1 parent 67aa02d commit c7c9a15

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/GitHub.Api/Application/ApiClient.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public void LoginWithToken(string token, Action<bool> result)
262262
Guard.ArgumentNotNull(result, "result");
263263

264264
new FuncTask<bool>(taskManager.Token,
265-
() => loginManager.LoginWithToken(HostAddress.ApiUri.Host, token))
265+
() => loginManager.LoginWithToken(HostAddress.WebUri.Host, token))
266266
.FinallyInUI((success, ex, res) =>
267267
{
268268
if (!success)
@@ -279,7 +279,7 @@ public void LoginWithToken(string token, Action<bool> result)
279279

280280
public void CreateOAuthToken(string code, Action<bool, string> result)
281281
{
282-
var command = "token -h " + HostAddress.WebUri.Host;
282+
var command = "token -h " + HostAddress.ApiUri.Host;
283283
var octorunTask = new OctorunTask(taskManager.Token, environment, command, code)
284284
.Configure(processManager);
285285

@@ -321,7 +321,7 @@ public void Login(string username, string password, Action<LoginResult> need2faC
321321
Guard.ArgumentNotNull(result, "result");
322322

323323
new FuncTask<LoginResultData>(taskManager.Token,
324-
() => loginManager.Login(HostAddress.ApiUri.Host, username, password))
324+
() => loginManager.Login(HostAddress.WebUri.Host, username, password))
325325
.FinallyInUI((success, ex, res) =>
326326
{
327327
if (!success)
@@ -388,7 +388,7 @@ private Connection Connection
388388
{
389389
if (connection == null)
390390
{
391-
connection = keychain.Connections.FirstOrDefault(x => x.Host == (UriString)HostAddress.ApiUri.Host);
391+
connection = keychain.Connections.FirstOrDefault(x => x.Host == (UriString)HostAddress.WebUri.Host);
392392
}
393393

394394
return connection;

src/GitHub.Api/Primitives/HostAddress.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,11 @@ public static bool IsGitHubDotCom(Connection connection)
8787
if (connection == null || String.IsNullOrEmpty(connection.Host))
8888
return false;
8989

90-
return connection.Host == GitHubDotComHostAddress.WebUri.Host
91-
|| connection.Host == GitHubDotComHostAddress.ApiUri.Host
92-
|| connection.Host == gistUri.Host;
90+
var connectionHost = connection.Host.ToUriString();
91+
92+
return connectionHost.Host == GitHubDotComHostAddress.WebUri.Host
93+
|| connectionHost.Host == GitHubDotComHostAddress.ApiUri.Host
94+
|| connectionHost.Host == gistUri.Host;
9395
}
9496

9597
public bool IsGitHubDotCom()

0 commit comments

Comments
 (0)