Skip to content

Commit d5a0e11

Browse files
authored
The github client lib doesn't properly format enterprise graphql urls (#18)
1 parent 0ab911e commit d5a0e11

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/connector/connector.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"net/http"
7+
"net/url"
78
"strings"
89

910
v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2"
@@ -187,7 +188,14 @@ func newGithubGraphqlClient(ctx context.Context, instanceURL string, accessToken
187188

188189
instanceURL = strings.TrimSuffix(instanceURL, "/")
189190
if instanceURL != "" && instanceURL != githubDotCom {
190-
return githubv4.NewEnterpriseClient(instanceURL, httpClient), nil
191+
gqlURL, err := url.Parse(instanceURL)
192+
if err != nil {
193+
return nil, err
194+
}
195+
196+
gqlURL.Path = "/api/graphql"
197+
198+
return githubv4.NewEnterpriseClient(gqlURL.String(), tc), nil
191199
}
192200

193201
return githubv4.NewClient(tc), nil

0 commit comments

Comments
 (0)