Skip to content

Commit 2b8a5b3

Browse files
committed
Fix panic when Hostname is used
1 parent afffc8e commit 2b8a5b3

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

oauth_device.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ func (oa *Flow) DeviceFlow() (*api.AccessToken, error) {
3232

3333
host := oa.Host
3434
if host == nil {
35-
host, err := NewGitHubHost("https://" + oa.Hostname)
35+
parsedHost, err := NewGitHubHost("https://" + oa.Hostname)
3636
if err != nil {
37-
return nil, fmt.Errorf("error parsing the hostname '%s': %w", host, err)
37+
return nil, fmt.Errorf("error parsing the hostname '%s': %w", oa.Hostname, err)
3838
}
39-
oa.Host = host
39+
host = parsedHost
4040
}
4141

4242
code, err := device.RequestCode(httpClient, host.DeviceCodeURL, oa.ClientID, oa.Scopes)

oauth_webapp.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ func (oa *Flow) WebAppFlow() (*api.AccessToken, error) {
1616
host := oa.Host
1717

1818
if host == nil {
19-
host, err := NewGitHubHost("https://" + oa.Hostname)
19+
parsedHost, err := NewGitHubHost("https://" + oa.Hostname)
2020
if err != nil {
21-
return nil, fmt.Errorf("error parsing the hostname '%s': %w", host, err)
21+
return nil, fmt.Errorf("error parsing the hostname '%s': %w", oa.Hostname, err)
2222
}
23-
oa.Host = host
23+
host = parsedHost
2424
}
2525

2626
flow, err := webapp.InitFlow()

0 commit comments

Comments
 (0)