Skip to content

Commit

Permalink
Fix panic when Hostname is used
Browse files Browse the repository at this point in the history
  • Loading branch information
williammartin committed Oct 9, 2024
1 parent afffc8e commit 0dabcc2
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", parsedHost, 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", parsedHost, err)
}
oa.Host = host
host = parsedHost
}

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

0 comments on commit 0dabcc2

Please sign in to comment.