You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by li...@apache.org on 2023/02/08 05:24:20 UTC

[incubator-devlake] branch main updated: fix: github graphql endpoint trailing slash edge case fix (#4352)

This is an automated email from the ASF dual-hosted git repository.

likyh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 09fee5316 fix: github graphql endpoint trailing slash edge case fix (#4352)
09fee5316 is described below

commit 09fee53167ef77ec54b24d2c0b254998d5e0d1cb
Author: Keon Amini <ke...@merico.dev>
AuthorDate: Tue Feb 7 23:24:15 2023 -0600

    fix: github graphql endpoint trailing slash edge case fix (#4352)
---
 backend/plugins/github_graphql/impl/impl.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/backend/plugins/github_graphql/impl/impl.go b/backend/plugins/github_graphql/impl/impl.go
index bce7bd56c..0e3200f8a 100644
--- a/backend/plugins/github_graphql/impl/impl.go
+++ b/backend/plugins/github_graphql/impl/impl.go
@@ -31,6 +31,7 @@ import (
 	"github.com/apache/incubator-devlake/plugins/github_graphql/tasks"
 	"github.com/merico-dev/graphql"
 	"golang.org/x/oauth2"
+	"net/url"
 	"reflect"
 	"strings"
 	"time"
@@ -162,7 +163,11 @@ func (p GithubGraphql) PrepareTaskData(taskCtx plugin.TaskContext, options map[s
 		&oauth2.Token{AccessToken: tokens[0]},
 	)
 	httpClient := oauth2.NewClient(taskCtx.GetContext(), src)
-	client := graphql.NewClient(connection.Endpoint+`graphql`, httpClient)
+	endpoint, err := errors.Convert01(url.JoinPath(connection.Endpoint, `graphql`))
+	if err != nil {
+		return nil, errors.BadInput.Wrap(err, fmt.Sprintf("malformed connection endpoint supplied: %s", connection.Endpoint))
+	}
+	client := graphql.NewClient(endpoint, httpClient)
 	graphqlClient, err := helper.CreateAsyncGraphqlClient(taskCtx, client, taskCtx.GetLogger(),
 		func(ctx context.Context, client *graphql.Client, logger log.Logger) (rateRemaining int, resetAt *time.Time, err errors.Error) {
 			var query GraphQueryRateLimit