aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-08-08 17:24:10 +0800
committerUnknwon <u@gogs.io>2015-08-08 17:24:10 +0800
commite3bdfd51ff4a3987c9c14d46d4c145f550b42d01 (patch)
treecb9629ce61cbc79e99fe9b910e92890e0dea4117 /routers
parent9db4acc62e2d253c21ce9aed2e21003ff235d5b5 (diff)
downloadgitea-e3bdfd51ff4a3987c9c14d46d4c145f550b42d01.tar.gz
gitea-e3bdfd51ff4a3987c9c14d46d4c145f550b42d01.zip
better fork permission check
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/pull.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/routers/repo/pull.go b/routers/repo/pull.go
index cb5167033c..a4ebb91a39 100644
--- a/routers/repo/pull.go
+++ b/routers/repo/pull.go
@@ -78,6 +78,12 @@ func ForkPost(ctx *middleware.Context, form auth.CreateRepoForm) {
return
}
+ repo, has := models.HasForkedRepo(ctxUser.Id, forkRepo.Id)
+ if has {
+ ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name)
+ return
+ }
+
// Check ownership of organization.
if ctxUser.IsOrganization() {
if !ctxUser.IsOwnedBy(ctx.User.Id) {