refactor: username sub route (#39967)

Remove the workaround for chi router, do as much as possible in
middlewares

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
authored and GitHub committed 2026-10-24 16:27:56 +08:00
1 parent fc49368845
commit 1d8474ee1f
13 files changed
+103 -117

No files matched your search

+1 -9
View File
@@ -5,7 +5,6 @@ package org
import (
"net/http"
"strings"
"gitea.dev/models/db"
"gitea.dev/models/organization"
@@ -25,14 +24,7 @@ const tplOrgHome templates.TplName = "org/home"
// Home show organization home page
func Home(ctx *context.Context) {
uname := ctx.PathParam("username")
if strings.HasSuffix(uname, ".keys") || strings.HasSuffix(uname, ".gpg") {
ctx.NotFound(nil)
return
}
ctx.SetPathParam("org", uname)
ctx.SetPathParam("org", ctx.PathParam("username"))
context.OrgAssignment(context.OrgAssignmentOptions{})(ctx)
if ctx.Written() {
return