diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2025-02-12 14:25:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-12 14:25:46 +0800 |
commit | f58f5bb3d8a92f30112d8914ed7006b72e28df05 (patch) | |
tree | d98327e00983123d28dc1298e9c1a8ec3e192a0a /routers | |
parent | 06f10656369c7e4274ae4e9f9edb21e1cac520d9 (diff) | |
download | gitea-f58f5bb3d8a92f30112d8914ed7006b72e28df05.tar.gz gitea-f58f5bb3d8a92f30112d8914ed7006b72e28df05.zip |
Avoid duplicate SetContextValue call (#33564)
And fix FIXME and TODO
Diffstat (limited to 'routers')
-rw-r--r-- | routers/install/install.go | 1 | ||||
-rw-r--r-- | routers/private/internal.go | 2 |
2 files changed, 1 insertions, 2 deletions
diff --git a/routers/install/install.go b/routers/install/install.go index 2cede3685d..8544717f65 100644 --- a/routers/install/install.go +++ b/routers/install/install.go @@ -64,7 +64,6 @@ func Contexter() func(next http.Handler) http.Handler { return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) { base := context.NewBaseContext(resp, req) ctx := context.NewWebContext(base, rnd, session.GetSession(req)) - ctx.SetContextValue(context.WebContextKey, ctx) // FIXME: this should be removed because NewWebContext should already set it ctx.Data.MergeFrom(middleware.CommonTemplateContextData()) ctx.Data.MergeFrom(reqctx.ContextData{ "Title": ctx.Locale.Tr("install.install"), diff --git a/routers/private/internal.go b/routers/private/internal.go index 2232c1b78c..55a11aa3dd 100644 --- a/routers/private/internal.go +++ b/routers/private/internal.go @@ -87,7 +87,7 @@ func Routes() *web.Router { // FIXME: it is not right to use context.Contexter here because all routes here should use PrivateContext // Fortunately, the LFS handlers are able to handle requests without a complete web context common.AddOwnerRepoGitLFSRoutes(r, func(ctx *context.PrivateContext) { - webContext := &context.Context{Base: ctx.Base} + webContext := &context.Context{Base: ctx.Base} // see above, it shouldn't manually construct the web context ctx.SetContextValue(context.WebContextKey, webContext) // FIXME: this is not ideal but no other way at the moment }) }) |