You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2017/03/06 21:16:45 UTC
[11/50] [abbrv] incubator-mynewt-newt git commit: MYNEWT-623;
github api server and git server are the same hostname in enterprise
github servers. API calls have a different prefix.
MYNEWT-623; github api server and git server are the same hostname
in enterprise github servers. API calls have a different prefix.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/ec61f09d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/ec61f09d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/ec61f09d
Branch: refs/heads/master
Commit: ec61f09d4c8f89cf1b0739ed202afb2e5199880d
Parents: 128feab
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue Feb 14 12:34:58 2017 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Tue Feb 14 12:37:03 2017 -0800
----------------------------------------------------------------------
newt/downloader/downloader.go | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/ec61f09d/newt/downloader/downloader.go
----------------------------------------------------------------------
diff --git a/newt/downloader/downloader.go b/newt/downloader/downloader.go
index 06557dd..0ab201e 100644
--- a/newt/downloader/downloader.go
+++ b/newt/downloader/downloader.go
@@ -118,12 +118,14 @@ func (gd *GenericDownloader) TempDir() (string, error) {
}
func (gd *GithubDownloader) FetchFile(name string, dest string) error {
- server := "github.com"
+ server := "api.github.com"
+ prefix := "repos"
if gd.Server != "" {
server = gd.Server
+ prefix = "api/v3/repos"
}
- url := fmt.Sprintf("https://api.%s/repos/%s/%s/contents/%s?ref=%s",
- server, gd.User, gd.Repo, name, gd.Branch())
+ url := fmt.Sprintf("https://%s/%s/%s/%s/contents/%s?ref=%s",
+ server, prefix, gd.User, gd.Repo, name, gd.Branch())
req, err := http.NewRequest("GET", url, nil)
req.Header.Add("Accept", "application/vnd.github.v3.raw")