Skip to content

Commit 8c996c6

Browse files
shilchlunny
andauthored
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 <[email protected]> for finding the quirk Co-authored-by: Lunny Xiao <[email protected]>
1 parent 1e5247d commit 8c996c6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

routers/routes/chi.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,12 @@ func RegisterInstallRoute(c chi.Router) {
230230
m := NewMacaron()
231231
RegisterMacaronInstallRoute(m)
232232

233+
// We need at least one handler in chi so that it does not drop
234+
// our middleware: https://github.com/go-gitea/gitea/issues/13725#issuecomment-735244395
235+
c.Get("/", func(w http.ResponseWriter, req *http.Request) {
236+
m.ServeHTTP(w, req)
237+
})
238+
233239
c.NotFound(func(w http.ResponseWriter, req *http.Request) {
234240
m.ServeHTTP(w, req)
235241
})

0 commit comments

Comments
 (0)