From c42b71877edb4830b9573101d20853222d66fb3c Mon Sep 17 00:00:00 2001
From: Lunny Xiao <xiaolunwen@gmail.com>
Date: Sat, 22 Jul 2023 19:47:06 +0800
Subject: [PATCH] Fix branch list auth (#26041)

The public repositories' branch list dropdown will return wrong because
it requires login wrongly.
Caused by #25719
---
 routers/web/web.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/routers/web/web.go b/routers/web/web.go
index 455791ad80..6d5ccad484 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)
@@ -1248,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)