Skip to content

Commit

Permalink
Merge pull request #70 from cli/69-v110-panics-when-hostname-is-used-…
Browse files Browse the repository at this point in the history
…rather-than-host-in-the-oauth-flow

Fix panic when Hostname is used
  • Loading branch information
williammartin authored Oct 9, 2024
2 parents afffc8e + 2b8a5b3 commit b410b89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions oauth_device.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ func (oa *Flow) DeviceFlow() (*api.AccessToken, error) {

host := oa.Host
if host == nil {
host, err := NewGitHubHost("https://" + oa.Hostname)
parsedHost, err := NewGitHubHost("https://" + oa.Hostname)
if err != nil {
return nil, fmt.Errorf("error parsing the hostname '%s': %w", host, err)
return nil, fmt.Errorf("error parsing the hostname '%s': %w", oa.Hostname, err)
}
oa.Host = host
host = parsedHost
}

code, err := device.RequestCode(httpClient, host.DeviceCodeURL, oa.ClientID, oa.Scopes)
Expand Down
6 changes: 3 additions & 3 deletions oauth_webapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ func (oa *Flow) WebAppFlow() (*api.AccessToken, error) {
host := oa.Host

if host == nil {
host, err := NewGitHubHost("https://" + oa.Hostname)
parsedHost, err := NewGitHubHost("https://" + oa.Hostname)
if err != nil {
return nil, fmt.Errorf("error parsing the hostname '%s': %w", host, err)
return nil, fmt.Errorf("error parsing the hostname '%s': %w", oa.Hostname, err)
}
oa.Host = host
host = parsedHost
}

flow, err := webapp.InitFlow()
Expand Down

0 comments on commit b410b89

Please sign in to comment.