summaryrefslogtreecommitdiffstats
path: root/modules/middleware
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-10-19 01:35:24 -0400
committerUnknwon <joe2010xtmf@163.com>2014-10-19 01:35:24 -0400
commita342d58d7e208ef64d29151970244de7f7b4fac6 (patch)
tree55972233ac1517513d865dc2ba4895b7cdaf95cb /modules/middleware
parentd7d167ac63e0ada717f78383016f5b208a1b209a (diff)
downloadgitea-a342d58d7e208ef64d29151970244de7f7b4fac6.tar.gz
gitea-a342d58d7e208ef64d29151970244de7f7b4fac6.zip
Able to fork repo to individuals
Diffstat (limited to 'modules/middleware')
-rw-r--r--modules/middleware/repo.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go
index 78af58eac8..fec9c54161 100644
--- a/modules/middleware/repo.go
+++ b/modules/middleware/repo.go
@@ -160,7 +160,11 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
return
}
ctx.Repo.GitRepo = gitRepo
- ctx.Repo.RepoLink = setting.AppSubUrl + "/" + u.Name + "/" + repo.Name
+ ctx.Repo.RepoLink, err = repo.RepoLink()
+ if err != nil {
+ ctx.Handle(500, "RepoLink", err)
+ return
+ }
ctx.Data["RepoLink"] = ctx.Repo.RepoLink
tags, err := ctx.Repo.GitRepo.GetTags()
@@ -171,6 +175,12 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
ctx.Data["Tags"] = tags
ctx.Repo.Repository.NumTags = len(tags)
+ // Non-fork repository will not return error in this method.
+ if err = repo.GetForkRepo(); err != nil {
+ ctx.Handle(500, "GetForkRepo", err)
+ return
+ }
+
ctx.Data["Title"] = u.Name + "/" + repo.Name
ctx.Data["Repository"] = repo
ctx.Data["Owner"] = ctx.Repo.Repository.Owner