diff options
author | silverwind <me@silverwind.io> | 2020-06-20 15:20:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-20 16:20:25 +0300 |
commit | e24ee487760cade0c47958fa8c4c1b980875900f (patch) | |
tree | c3a784da82375f3254f5d3b6daac99cda92cda10 /modules/public | |
parent | 6891b90303c391f5b7cbb2ff1a259526d927defb (diff) | |
download | gitea-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 'modules/public')
-rw-r--r-- | modules/public/public.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/public/public.go b/modules/public/public.go index fb8d9c1955..8d027855c2 100644 --- a/modules/public/public.go +++ b/modules/public/public.go @@ -30,12 +30,13 @@ type Options struct { Prefix string } -// List of known entries inside the `public` directory -var knownEntries = []string{ +// KnownPublicEntries list all direct children in the `public` directory +var KnownPublicEntries = []string{ "css", "fomantic", "img", "js", + "serviceworker.js", "vendor", } @@ -114,7 +115,7 @@ func (opts *Options) handle(ctx *macaron.Context, log *log.Logger, opt *Options) if len(parts) < 2 { return false } - for _, entry := range knownEntries { + for _, entry := range KnownPublicEntries { if entry == parts[1] { ctx.Resp.WriteHeader(404) return true |