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:44:08 UTC

[08/41] 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/c06ba1f3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/c06ba1f3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/c06ba1f3

Branch: refs/heads/mynewt_1_0_0
Commit: c06ba1f3ffb3fe7f186bb7f6b1d7a8cd22ee746b
Parents: 3e4102b
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue Feb 14 12:34:58 2017 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Mon Mar 6 13:31:51 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/c06ba1f3/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")