diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-06-10 03:02:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-09 19:02:33 +0000 |
commit | feb38da259c9e3b05fe227838b9886e7dc8486ed (patch) | |
tree | 0bf70ae2f595029e7a907a4c75c53fe9229db523 /routers | |
parent | 96f9c11821d6b5ef547c9d858e0d8dd9dc474ff3 (diff) | |
download | gitea-feb38da259c9e3b05fe227838b9886e7dc8486ed.tar.gz gitea-feb38da259c9e3b05fe227838b9886e7dc8486ed.zip |
Fix bug for code search if code is disabled (#25173)
Fix https://github.com/go-gitea/gitea/pull/24189/files#r1224144768
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/web.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/routers/web/web.go b/routers/web/web.go index f5037a848e..1e235a3c3c 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -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() { |