From b0dc8672c589642ace2d4ceea475049a12241736 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 21 Jul 2023 23:38:45 +0800 Subject: [PATCH 1/2] Fix branch list auth --- routers/web/web.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/routers/web/web.go b/routers/web/web.go index 455791ad802df..e7ad54c114729 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -1091,7 +1091,6 @@ func registerRoutes(m *web.Route) { }, context.RepoRef(), canEnableEditor, context.RepoMustNotBeArchived()) m.Group("/branches", func() { - m.Get("/list", repo.GetBranchesList) m.Group("/_new", func() { m.Post("/branch/*", context.RepoRefByType(context.RepoRefBranch), repo.CreateBranch) m.Post("/tag/*", context.RepoRefByType(context.RepoRefTag), repo.CreateBranch) @@ -1104,6 +1103,10 @@ func registerRoutes(m *web.Route) { // Tags m.Group("/{username}/{reponame}", func() { + m.Group("/branches", func() { + m.Get("/list", repo.GetBranchesList) + }) + m.Group("/tags", func() { m.Get("", repo.TagsList) m.Get("/list", repo.GetTagList) From 5029b869debd707794c98f1e98938176ddc649bb Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 21 Jul 2023 23:58:01 +0800 Subject: [PATCH 2/2] Move branch list to corrrect place --- routers/web/web.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/routers/web/web.go b/routers/web/web.go index e7ad54c114729..6d5ccad484fa0 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -1103,10 +1103,6 @@ func registerRoutes(m *web.Route) { // Tags m.Group("/{username}/{reponame}", func() { - m.Group("/branches", func() { - m.Get("/list", repo.GetBranchesList) - }) - m.Group("/tags", func() { m.Get("", repo.TagsList) m.Get("/list", repo.GetTagList) @@ -1251,6 +1247,7 @@ func registerRoutes(m *web.Route) { }, repo.MustBeNotEmpty, dlSourceEnabled, reqRepoCodeReader) m.Group("/branches", func() { + m.Get("/list", repo.GetBranchesList) m.Get("", repo.Branches) }, repo.MustBeNotEmpty, context.RepoRef(), reqRepoCodeReader)