Skip to content

Commit 4cb1c15

Browse files
author
Gusted
committed
Send 404 on /{org}.gpg (go-gitea#18959)
Backport go-gitea#18959
1 parent 43fc2e5 commit 4cb1c15

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

routers/web/org/home.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package org
66

77
import (
88
"net/http"
9+
"strings"
910

1011
"code.gitea.io/gitea/models"
1112
"code.gitea.io/gitea/models/db"
@@ -23,7 +24,14 @@ const (
2324

2425
// Home show organization home page
2526
func Home(ctx *context.Context) {
26-
ctx.SetParams(":org", ctx.Params(":username"))
27+
uname := ctx.Params(":username")
28+
29+
if strings.HasSuffix(uname, ".keys") || strings.HasSuffix(uname, ".gpg") {
30+
ctx.NotFound("", nil)
31+
return
32+
}
33+
34+
ctx.SetParams(":org", uname)
2735
context.HandleOrgAssignment(ctx)
2836
if ctx.Written() {
2937
return
@@ -109,7 +117,7 @@ func Home(ctx *context.Context) {
109117
return
110118
}
111119

112-
var opts = &models.FindOrgMembersOpts{
120+
opts := &models.FindOrgMembersOpts{
113121
OrgID: org.ID,
114122
PublicOnly: true,
115123
ListOptions: db.ListOptions{Page: 1, PageSize: 25},

0 commit comments

Comments
 (0)