Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-29 13:16:10 +01:00

Fix missing stylesheets on installation page (#13736)

When running gitea for the first time, the stylesheets for the
installation page are broken since the middleware that statically serves
stylesheets does not get executed by chi. This is because if no handlers
are registered in chi, it will drop all middleware.

This commit introduces a "dummy" handler to deal with that quirk.

Closes #13725

Thanks: Lunny Xiao <xiaolunwen@gmail.com> for finding the quirk

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Simon 2020-11-28 18:52:30 +01:00 committed by GitHub
parent 1e5247d424
commit 8c996c6505
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -230,6 +230,12 @@ func RegisterInstallRoute(c chi.Router) {
m := NewMacaron() m := NewMacaron()
RegisterMacaronInstallRoute(m) RegisterMacaronInstallRoute(m)
// We need at least one handler in chi so that it does not drop
// our middleware: https://github.com/go-gitea/gitea/issues/13725#issuecomment-735244395
c.Get("/", func(w http.ResponseWriter, req *http.Request) {
m.ServeHTTP(w, req)
})
c.NotFound(func(w http.ResponseWriter, req *http.Request) { c.NotFound(func(w http.ResponseWriter, req *http.Request) {
m.ServeHTTP(w, req) m.ServeHTTP(w, req)
}) })