aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-12-13 16:46:00 -0500
committerUnknwon <joe2010xtmf@163.com>2014-12-13 16:46:00 -0500
commitb553ea45ee29f5fc4f123c9f1083b90104ec4fe4 (patch)
treedc94dd0814d260e2f48560db2b9a091a9d3b33dd /routers/api
parentac4a10456ea4515091c3c90a83a82c1e59cdf428 (diff)
downloadgitea-b553ea45ee29f5fc4f123c9f1083b90104ec4fe4.tar.gz
gitea-b553ea45ee29f5fc4f123c9f1083b90104ec4fe4.zip
modes/repo: incorrect SSH clone URL for #742
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/repo.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/routers/api/v1/repo.go b/routers/api/v1/repo.go
index 6f23723164..fbf9c73ea7 100644
--- a/routers/api/v1/repo.go
+++ b/routers/api/v1/repo.go
@@ -23,20 +23,19 @@ import (
// ToApiRepository converts repository to API format.
func ToApiRepository(owner *models.User, repo *models.Repository, permission api.Permission) *api.Repository {
- sshUrlFmt := "%s@%s:%s/%s.git"
- if setting.SshPort != 22 {
- sshUrlFmt = "ssh://%s@%s:%d/%s/%s.git"
+ cl, err := repo.CloneLink()
+ if err != nil {
+ log.Error(4, "CloneLink: %v", err)
}
- htmlUrl := setting.AppUrl + owner.Name + "/" + repo.Name
return &api.Repository{
Id: repo.Id,
Owner: *ToApiUser(owner),
FullName: owner.Name + "/" + repo.Name,
Private: repo.IsPrivate,
Fork: repo.IsFork,
- HtmlUrl: htmlUrl,
- SshUrl: fmt.Sprintf(sshUrlFmt, setting.RunUser, setting.Domain, owner.LowerName, repo.LowerName),
- CloneUrl: htmlUrl + ".git",
+ HtmlUrl: setting.AppUrl + owner.Name + "/" + repo.Name,
+ CloneUrl: cl.HTTPS,
+ SshUrl: cl.SSH,
Permissions: permission,
}
}