Fix endpoint variable being changed by range

This commit is contained in:
Melon 2022-03-29 00:21:18 +01:00
parent a62611c6fa
commit 4adf0ce931
Signed by: melon
GPG Key ID: B0ADD5395BCDAAB6

View File

@ -45,8 +45,9 @@ func main() {
gob.Register(uuid.UUID{}) gob.Register(uuid.UUID{})
for _, v := range modules { for _, v := range modules {
router.HandleFunc(v.GetEndpoint(), func(rw http.ResponseWriter, req *http.Request) { a := v.GetEndpoint()
http.Redirect(rw, req, v.GetEndpoint()+"/", http.StatusTemporaryRedirect) router.HandleFunc(a, func(rw http.ResponseWriter, req *http.Request) {
http.Redirect(rw, req, a+"/", http.StatusTemporaryRedirect)
}) })
v.SetupModule(router.PathPrefix(v.GetEndpoint()).Subrouter(), stateManager.sessionWrapper) v.SetupModule(router.PathPrefix(v.GetEndpoint()).Subrouter(), stateManager.sessionWrapper)
} }