]> source.dussan.org Git - gitea.git/commitdiff
Fix #94 and fix #169
authorUnknown <joe2010xtmf@163.com>
Sun, 11 May 2014 16:17:10 +0000 (12:17 -0400)
committerUnknown <joe2010xtmf@163.com>
Sun, 11 May 2014 16:17:10 +0000 (12:17 -0400)
cmd/serve.go
modules/middleware/repo.go

index e881717c3ea052e4ab8a2b4058bbbf11e8a66c69..5eac51f5e4778978f7afb0dbc2cb91bc31adec70 100644 (file)
@@ -68,7 +68,7 @@ func parseCmd(cmd string) (string, string) {
                args = ss[1]
                verb = fmt.Sprintf("%s %s", verb, ss[0])
        }
-       return verb, args
+       return verb, strings.Replace(args, "'/", "'", 1)
 }
 
 func In(b string, sl map[string]int) bool {
@@ -128,7 +128,7 @@ func runServ(k *cli.Context) {
        repoUser, err := models.GetUserByName(repoUserName)
        if err != nil {
                println("You have no right to access")
-               qlog.Fatal("Get user failed", err)
+               qlog.Fatalf("Get user failed: %v", err)
        }
 
        // access check
index 1516482167d961489c513a9845c27f4880d523a8..ff99f82897b37ff499a27643b7d8c2f4372fdfce 100644 (file)
@@ -153,11 +153,11 @@ func RepoAssignment(redirect bool, args ...bool) martini.Handler {
                ctx.Data["IsRepositoryOwner"] = ctx.Repo.IsOwner
                ctx.Data["BranchName"] = ""
 
-               sshPrefix := ""
                if base.SshPort != 22 {
-                       sshPrefix = "ssh://"
+                       ctx.Repo.CloneLink.SSH = fmt.Sprintf("ssh://%s@%s/%s/%s.git", base.RunUser, base.Domain, user.LowerName, repo.LowerName)
+               } else {
+                       ctx.Repo.CloneLink.SSH = fmt.Sprintf("%s@%s:%s/%s.git", base.RunUser, base.Domain, user.LowerName, repo.LowerName)
                }
-               ctx.Repo.CloneLink.SSH = fmt.Sprintf("%s%s@%s:%s/%s.git", sshPrefix, base.RunUser, base.Domain, user.LowerName, repo.LowerName)
                ctx.Repo.CloneLink.HTTPS = fmt.Sprintf("%s%s/%s.git", base.AppUrl, user.LowerName, repo.LowerName)
                ctx.Data["CloneLink"] = ctx.Repo.CloneLink