From 35ae51fa0c66d5b3865780b9071eb917313e6c75 Mon Sep 17 00:00:00 2001 From: Forrest Marshall Date: Fri, 2 Jun 2023 22:50:24 +0000 Subject: [PATCH] fix github url formatting backport --- lib/auth/github.go | 2 +- lib/auth/github_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/auth/github.go b/lib/auth/github.go index ea9a1539705b6..5963d2f5a1c0e 100644 --- a/lib/auth/github.go +++ b/lib/auth/github.go @@ -980,7 +980,7 @@ func (c *githubAPIClient) get(page string) ([]byte, string, error) { // formatGithubURL is a helper for formatting github api request URLs. func formatGithubURL(host string, path string) string { - return fmt.Sprintf("https://%s/%s", host, strings.TrimPrefix(path, "/")) + return fmt.Sprintf("https://api.%s/%s", host, strings.TrimPrefix(path, "/")) } const ( diff --git a/lib/auth/github_test.go b/lib/auth/github_test.go index eca56e149e35a..dafcab05da009 100644 --- a/lib/auth/github_test.go +++ b/lib/auth/github_test.go @@ -543,17 +543,17 @@ func TestGithubURLFormat(t *testing.T) { { host: "example.com", path: "foo/bar", - expect: "https://example.com/foo/bar", + expect: "https://api.example.com/foo/bar", }, { host: "example.com", path: "/foo/bar?spam=eggs", - expect: "https://example.com/foo/bar?spam=eggs", + expect: "https://api.example.com/foo/bar?spam=eggs", }, { host: "example.com", path: "/foo/bar", - expect: "https://example.com/foo/bar", + expect: "https://api.example.com/foo/bar", }, }