mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
Send 404 immediately for known public requests (#11117)
Instead of further handling requests to public which causes issues like #11088, immediately terminate requests to directories js, css, fomantic if no file is found which is checked against a hardcoded list. Maybe there is a way to retrieve the top-level entries below public in a dynamic fashion. I also added fomantic to the reserved usernames and sorted the list. Fixes: #11088
This commit is contained in:
parent
6034f8bcaa
commit
5180deb819
2 changed files with 30 additions and 7 deletions
|
@ -844,16 +844,20 @@ func (u *User) IsGhost() bool {
|
|||
|
||||
var (
|
||||
reservedUsernames = []string{
|
||||
"attachments",
|
||||
".",
|
||||
"..",
|
||||
".well-known",
|
||||
"admin",
|
||||
"api",
|
||||
"assets",
|
||||
"attachments",
|
||||
"avatars",
|
||||
"commits",
|
||||
"css",
|
||||
"debug",
|
||||
"error",
|
||||
"explore",
|
||||
"fomantic",
|
||||
"ghost",
|
||||
"help",
|
||||
"img",
|
||||
|
@ -861,6 +865,7 @@ var (
|
|||
"issues",
|
||||
"js",
|
||||
"less",
|
||||
"login",
|
||||
"manifest.json",
|
||||
"metrics",
|
||||
"milestones",
|
||||
|
@ -871,16 +876,12 @@ var (
|
|||
"pulls",
|
||||
"raw",
|
||||
"repo",
|
||||
"robots.txt",
|
||||
"search",
|
||||
"stars",
|
||||
"template",
|
||||
"user",
|
||||
"vendor",
|
||||
"login",
|
||||
"robots.txt",
|
||||
".",
|
||||
"..",
|
||||
".well-known",
|
||||
"search",
|
||||
}
|
||||
reservedUserPatterns = []string{"*.keys", "*.gpg"}
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue