1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-04 14:46:57 -05:00

Some following up changes for routes (#30550)

1. Switch back to the old order for `reqRepoAdmin, context.RepoRef()`
2. Add a routing function info for global NotFound
This commit is contained in:
wxiaoguang 2024-04-18 17:36:19 +08:00 committed by GitHub
parent d4ec6b3d16
commit d1ba5f431b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -54,10 +54,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
)
const (
// GzipMinSize represents min size to compress for the body size of response
GzipMinSize = 1400
)
const GzipMinSize = 1400 // min size to compress for the body size of response
// optionsCorsHandler return a http handler which sets CORS options if enabled by config, it blocks non-CORS OPTIONS requests.
func optionsCorsHandler() func(next http.Handler) http.Handler {
@ -1115,7 +1112,7 @@ func registerRoutes(m *web.Route) {
m.Post("/cancel", repo.MigrateCancelPost)
})
},
reqSignIn, context.RepoAssignment, context.RepoRef(), reqRepoAdmin,
reqSignIn, context.RepoAssignment, reqRepoAdmin, context.RepoRef(),
ctxDataSet("PageIsRepoSettings", true, "LFSStartServer", setting.LFS.StartServer),
)
// end "/{username}/{reponame}/settings"
@ -1613,6 +1610,7 @@ func registerRoutes(m *web.Route) {
m.NotFound(func(w http.ResponseWriter, req *http.Request) {
ctx := context.GetWebContext(req)
routing.UpdateFuncInfo(ctx, routing.GetFuncInfo(ctx.NotFound, "GlobalNotFound"))
ctx.NotFound("", nil)
})
}