diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-12-13 16:46:00 -0500 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-12-13 16:46:00 -0500 |
commit | b553ea45ee29f5fc4f123c9f1083b90104ec4fe4 (patch) | |
tree | dc94dd0814d260e2f48560db2b9a091a9d3b33dd /modules/middleware | |
parent | ac4a10456ea4515091c3c90a83a82c1e59cdf428 (diff) | |
download | gitea-b553ea45ee29f5fc4f123c9f1083b90104ec4fe4.tar.gz gitea-b553ea45ee29f5fc4f123c9f1083b90104ec4fe4.zip |
modes/repo: incorrect SSH clone URL for #742
Diffstat (limited to 'modules/middleware')
-rw-r--r-- | modules/middleware/context.go | 42 | ||||
-rw-r--r-- | modules/middleware/repo.go | 9 |
2 files changed, 23 insertions, 28 deletions
diff --git a/modules/middleware/context.go b/modules/middleware/context.go index fb33c48e0e..fc7814401f 100644 --- a/modules/middleware/context.go +++ b/modules/middleware/context.go @@ -39,29 +39,25 @@ type Context struct { IsBasicAuth bool Repo struct { - IsOwner bool - IsTrueOwner bool - IsWatching bool - IsBranch bool - IsTag bool - IsCommit bool - IsAdmin bool // Current user is admin level. - HasAccess bool - Repository *models.Repository - Owner *models.User - Commit *git.Commit - Tag *git.Tag - GitRepo *git.Repository - BranchName string - TagName string - TreeName string - CommitId string - RepoLink string - CloneLink struct { - SSH string - HTTPS string - Git string - } + IsOwner bool + IsTrueOwner bool + IsWatching bool + IsBranch bool + IsTag bool + IsCommit bool + IsAdmin bool // Current user is admin level. + HasAccess bool + Repository *models.Repository + Owner *models.User + Commit *git.Commit + Tag *git.Tag + GitRepo *git.Repository + BranchName string + TagName string + TreeName string + CommitId string + RepoLink string + CloneLink models.CloneLink CommitsCount int Mirror *models.Mirror } diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go index 1716194925..d143d8a86b 100644 --- a/modules/middleware/repo.go +++ b/modules/middleware/repo.go @@ -386,12 +386,11 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler { ctx.Data["IsRepositoryOwner"] = ctx.Repo.IsOwner ctx.Data["IsRepositoryTrueOwner"] = ctx.Repo.IsTrueOwner - if setting.SshPort != 22 { - ctx.Repo.CloneLink.SSH = fmt.Sprintf("ssh://%s@%s:%d/%s/%s.git", setting.RunUser, setting.Domain, setting.SshPort, u.LowerName, repo.LowerName) - } else { - ctx.Repo.CloneLink.SSH = fmt.Sprintf("%s@%s:%s/%s.git", setting.RunUser, setting.Domain, u.LowerName, repo.LowerName) + ctx.Repo.CloneLink, err = repo.CloneLink() + if err != nil { + ctx.Handle(500, "CloneLink", err) + return } - ctx.Repo.CloneLink.HTTPS = fmt.Sprintf("%s%s/%s.git", setting.AppUrl, u.LowerName, repo.LowerName) ctx.Data["CloneLink"] = ctx.Repo.CloneLink if ctx.Repo.Repository.IsGoget { |