Browse Source

fix wrong Upper/Lower case in HTTP/SSH CloneLinks

use origin repo name for HTTP clone link
use lower case repo name for SSH clone link
pull/4789/head
Siwei Chen 7 years ago committed by GitHub
parent
commit
cfa9d5d6df
  1. 5
      models/repo.go

5
models/repo.go

@ -615,13 +615,14 @@ func (repo *Repository) cloneLink(isWiki bool) *CloneLink {
if isWiki { if isWiki {
repoName += ".wiki" repoName += ".wiki"
} }
repoLowerName := strings.ToLower(repoName)
repo.Owner = repo.MustOwner() repo.Owner = repo.MustOwner()
cl := new(CloneLink) cl := new(CloneLink)
if setting.SSH.Port != 22 { if setting.SSH.Port != 22 {
cl.SSH = fmt.Sprintf("ssh://%s@%s:%d/%s/%s.git", setting.RunUser, setting.SSH.Domain, setting.SSH.Port, repo.Owner.Name, repoName) cl.SSH = fmt.Sprintf("ssh://%s@%s:%d/%s/%s.git", setting.RunUser, setting.SSH.Domain, setting.SSH.Port, repo.Owner.Name, repoLowerName)
} else { } else {
cl.SSH = fmt.Sprintf("%s@%s:%s/%s.git", setting.RunUser, setting.SSH.Domain, repo.Owner.Name, repoName) cl.SSH = fmt.Sprintf("%s@%s:%s/%s.git", setting.RunUser, setting.SSH.Domain, repo.Owner.Name, repoLowerName)
} }
cl.HTTPS = ComposeHTTPSCloneURL(repo.Owner.Name, repoName) cl.HTTPS = ComposeHTTPSCloneURL(repo.Owner.Name, repoName)
return cl return cl

Loading…
Cancel
Save