diff options
author | Unknwon <u@gogs.io> | 2018-12-03 13:24:31 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2018-12-03 13:24:31 -0500 |
commit | a7e8187a0d52cb45468dec76f96a087d63c27da9 (patch) | |
tree | f17e9a92334622166916282e224134e502c696dd /pkg/context/context.go | |
parent | 0c1b72616a9b1689c9a469610f3391ff51c7d2cd (diff) |
pkg/context: expose port in import path for 'go-get=1' (#5305)
Diffstat (limited to 'pkg/context/context.go')
-rw-r--r-- | pkg/context/context.go | 8 |
1 files changed, 7 insertions, 1 deletions
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(`<!doctype html> <html> @@ -275,7 +281,7 @@ func Contexter() macaron.Handler { </body> </html> `, 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}", |