aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/web.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-03-01 20:52:30 +0800
committerGitHub <noreply@github.com>2024-03-01 12:52:30 +0000
commit194479a7416cffdc151e6b75a895d566e5970dca (patch)
tree52c3be29370cb8701daaca9618dfeec609e55e21 /routers/web/web.go
parent2ca5daf07e5816343c1018f5773e7a2c671f3777 (diff)
downloadgitea-194479a7416cffdc151e6b75a895d566e5970dca.tar.gz
gitea-194479a7416cffdc151e6b75a895d566e5970dca.zip
Use a predictiable fork URL to allow forking repositories without providing a repo ID (#29519)
Close #29512 The "fork" URL: * Before: `/repo/fork/{RepoID}` * After: `/{OwnerName}/{RepoName}/fork`
Diffstat (limited to 'routers/web/web.go')
-rw-r--r--routers/web/web.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/routers/web/web.go b/routers/web/web.go
index b6dd9500c8..9de652fba5 100644
--- a/routers/web/web.go
+++ b/routers/web/web.go
@@ -956,10 +956,6 @@ func registerRoutes(m *web.Route) {
m.Post("/create", web.Bind(forms.CreateRepoForm{}), repo.CreatePost)
m.Get("/migrate", repo.Migrate)
m.Post("/migrate", web.Bind(forms.MigrateRepoForm{}), repo.MigratePost)
- m.Group("/fork", func() {
- m.Combo("/{repoid}").Get(repo.Fork).
- Post(web.Bind(forms.CreateRepoForm{}), repo.ForkPost)
- }, context.RepoIDAssignment(), context.UnitTypes(), reqRepoCodeReader)
m.Get("/search", repo.SearchRepo)
}, reqSignIn)
@@ -1255,6 +1251,8 @@ func registerRoutes(m *web.Route) {
m.Post("/delete", repo.DeleteBranchPost)
m.Post("/restore", repo.RestoreBranchPost)
}, context.RepoMustNotBeArchived(), reqRepoCodeWriter, repo.MustBeNotEmpty)
+
+ m.Combo("/fork", reqRepoCodeReader).Get(repo.Fork).Post(web.Bind(forms.CreateRepoForm{}), repo.ForkPost)
}, reqSignIn, context.RepoAssignment, context.UnitTypes())
// Tags