Browse Source

use ssh domain for go-import meta tag if http git is disabled

pull/5122/head
Miika Petäjäniemi 7 years ago
parent
commit
144c929c15
  1. 10
      pkg/context/context.go

10
pkg/context/context.go

@ -243,6 +243,16 @@ func Contexter() macaron.Handler {
branchName = repo.DefaultBranch
}
cloneLink := models.ComposeHTTPSCloneURL(ownerName, repoName)
if setting.Repository.DisableHTTPGit {
if setting.SSH.Port != 22 {
cloneLink = fmt.Sprintf("ssh://%s@%s:%d/%s/%s.git", setting.RunUser, setting.SSH.Domain, setting.SSH.Port, ownerName, repoName)
} else {
cloneLink = fmt.Sprintf("%s@%s:%s/%s.git", setting.RunUser, setting.SSH.Domain, ownerName, repoName)
}
}
prefix := setting.AppURL + path.Join(ownerName, repoName, "src", branchName)
c.PlainText(http.StatusOK, []byte(com.Expand(`<!doctype html>
<html>

Loading…
Cancel
Save