aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2022-03-02 01:37:32 +0000
committerGitHub <noreply@github.com>2022-03-01 20:37:32 -0500
commita90041d71aa1ee3c0e4040c42ebc7ff488220802 (patch)
tree39d81b989e27a55d9700e6b00165b560c0d245e3 /routers/web
parent1f45d1e1303c5843ceeb473eef343b82491bd706 (diff)
downloadgitea-a90041d71aa1ee3c0e4040c42ebc7ff488220802.tar.gz
gitea-a90041d71aa1ee3c0e4040c42ebc7ff488220802.zip
Send 404 on `/{org}.gpg` (#18959)
Diffstat (limited to 'routers/web')
-rw-r--r--routers/web/org/home.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/routers/web/org/home.go b/routers/web/org/home.go
index d07e2993b2..fc81ceb719 100644
--- a/routers/web/org/home.go
+++ b/routers/web/org/home.go
@@ -6,6 +6,7 @@ package org
import (
"net/http"
+ "strings"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/db"
@@ -23,7 +24,14 @@ const (
// Home show organization home page
func Home(ctx *context.Context) {
- ctx.SetParams(":org", ctx.Params(":username"))
+ uname := ctx.Params(":username")
+
+ if strings.HasSuffix(uname, ".keys") || strings.HasSuffix(uname, ".gpg") {
+ ctx.NotFound("", nil)
+ return
+ }
+
+ ctx.SetParams(":org", uname)
context.HandleOrgAssignment(ctx)
if ctx.Written() {
return