Skip to content

Commit 52517e3

Browse files
author
Gusted
authored
Send 404 on /{org}.gpg (#18959) (#18962)
1 parent 36e96e3 commit 52517e3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

routers/web/org/home.go

+10-2
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)