From a7e8187a0d52cb45468dec76f96a087d63c27da9 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Mon, 3 Dec 2018 13:24:31 -0500 Subject: pkg/context: expose port in import path for 'go-get=1' (#5305) --- gogs.go | 2 +- pkg/context/context.go | 8 +++++++- templates/.VERSION | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gogs.go b/gogs.go index 9c3171d3..97035133 100644 --- a/gogs.go +++ b/gogs.go @@ -16,7 +16,7 @@ import ( "github.com/gogs/gogs/pkg/setting" ) -const APP_VER = "0.11.74.1202" +const APP_VER = "0.11.75.1203" func init() { setting.AppVer = APP_VER diff --git a/pkg/context/context.go b/pkg/context/context.go index a225ce67..08e3b6ea 100644 --- a/pkg/context/context.go +++ b/pkg/context/context.go @@ -263,6 +263,12 @@ func Contexter() macaron.Handler { branchName = repo.DefaultBranch } + // Non-80 port needs to match port number in import path as well + host := setting.Domain + if setting.HTTPPort != "80" { + host += ":" + setting.HTTPPort + } + prefix := setting.AppURL + path.Join(ownerName, repoName, "src", branchName) c.PlainText(http.StatusOK, []byte(com.Expand(` @@ -275,7 +281,7 @@ func Contexter() macaron.Handler { `, map[string]string{ - "GoGetImport": path.Join(setting.Domain, setting.AppSubURL, repo.FullName()), + "GoGetImport": path.Join(host, setting.AppSubURL, repo.FullName()), "CloneLink": models.ComposeHTTPSCloneURL(ownerName, repoName), "GoDocDirectory": prefix + "{/dir}", "GoDocFile": prefix + "{/dir}/{file}#L{line}", diff --git a/templates/.VERSION b/templates/.VERSION index 5aa190e4..67ca82d9 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.11.74.1202 +0.11.75.1203 -- cgit v1.2.3