Skip to content

Commit

Permalink
Fix bug for code search if code is disabled (#25173) (#25181)
Browse files Browse the repository at this point in the history
Backport #25173 by @lunny

Fix https://github.com/go-gitea/gitea/pull/24189/files#r1224144768

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
  • Loading branch information
GiteaBot and lunny authored Jun 9, 2023
1 parent 0058453 commit de1d145
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion routers/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,12 @@ func registerRoutes(m *web.Route) {
m.Get("/users", explore.Users)
m.Get("/users/sitemap-{idx}.xml", sitemapEnabled, explore.Users)
m.Get("/organizations", explore.Organizations)
m.Get("/code", reqUnitAccess(unit.TypeCode, perm.AccessModeRead), explore.Code)
m.Get("/code", func(ctx *context.Context) {
if unit.TypeCode.UnitGlobalDisabled() {
ctx.NotFound(unit.TypeCode.String(), nil)
return
}
}, explore.Code)
m.Get("/topics/search", explore.TopicSearch)
}, ignExploreSignIn)
m.Group("/issues", func() {
Expand Down

0 comments on commit de1d145

Please sign in to comment.