aboutsummaryrefslogtreecommitdiffstats
path: root/models/user.go
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2020-06-20 15:20:25 +0200
committerGitHub <noreply@github.com>2020-06-20 16:20:25 +0300
commite24ee487760cade0c47958fa8c4c1b980875900f (patch)
treec3a784da82375f3254f5d3b6daac99cda92cda10 /models/user.go
parent6891b90303c391f5b7cbb2ff1a259526d927defb (diff)
downloadgitea-e24ee487760cade0c47958fa8c4c1b980875900f.tar.gz
gitea-e24ee487760cade0c47958fa8c4c1b980875900f.zip
Add serviceworker.js to KnownPublicEntries (#11992)
Fixes a wrong 302 redirect to the login page, see https://github.com/go-gitea/gitea/issues/11989. Also made it so the reserved username list is extended with those known entries so we avoid code duplication. Should be backported to 1.12.
Diffstat (limited to 'models/user.go')
-rw-r--r--models/user.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/models/user.go b/models/user.go
index 4597508fb1..608bf219cf 100644
--- a/models/user.go
+++ b/models/user.go
@@ -29,6 +29,7 @@ import (
"code.gitea.io/gitea/modules/generate"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
+ "code.gitea.io/gitea/modules/public"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"
api "code.gitea.io/gitea/modules/structs"
@@ -879,7 +880,7 @@ func (u *User) IsGhost() bool {
}
var (
- reservedUsernames = []string{
+ reservedUsernames = append([]string{
".",
"..",
".well-known",
@@ -889,17 +890,13 @@ var (
"attachments",
"avatars",
"commits",
- "css",
"debug",
"error",
"explore",
- "fomantic",
"ghost",
"help",
- "img",
"install",
"issues",
- "js",
"less",
"login",
"manifest.json",
@@ -917,8 +914,8 @@ var (
"stars",
"template",
"user",
- "vendor",
- }
+ }, public.KnownPublicEntries...)
+
reservedUserPatterns = []string{"*.keys", "*.gpg"}
)