all: fix trailing slash in subrouters
Some checks are pending
Go / Lint (latest) (push) Waiting to run
Go / Build (old, libolm) (push) Waiting to run
Go / Build (latest, libolm) (push) Waiting to run
Go / Build (old, goolm) (push) Waiting to run
Go / Build (latest, goolm) (push) Waiting to run

This commit is contained in:
Tulir Asokan 2025-07-28 22:03:43 +03:00
commit 2e7ff3fedd
3 changed files with 10 additions and 5 deletions

View file

@ -142,15 +142,17 @@ func (prov *ProvisioningAPI) Init() {
debugRouter.HandleFunc("GET /pprof/symbol", pprof.Symbol)
debugRouter.HandleFunc("GET /pprof/trace", pprof.Trace)
debugRouter.HandleFunc("/pprof/", pprof.Index)
prov.br.AS.Router.Handle("/debug", exhttp.ApplyMiddleware(
prov.br.AS.Router.Handle("/debug/", exhttp.ApplyMiddleware(
debugRouter,
exhttp.StripPrefix("/debug"),
hlog.NewHandler(prov.br.Log.With().Str("component", "debug api").Logger()),
prov.DebugAuthMiddleware,
))
}
prov.br.AS.Router.Handle("/_matrix/provision", exhttp.ApplyMiddleware(
prov.br.AS.Router.Handle("/_matrix/provision/", exhttp.ApplyMiddleware(
prov.Router,
exhttp.StripPrefix("/_matrix/provision"),
hlog.NewHandler(prov.log),
hlog.RequestIDHandler("request_id", "Request-Id"),
exhttp.CORSMiddleware,

View file

@ -62,8 +62,9 @@ func (ks *KeyServer) Register(r *http.ServeMux) {
NotFound: exerrors.Must(json.Marshal(mautrix.MUnrecognized.WithMessage("Unrecognized endpoint"))),
MethodNotAllowed: exerrors.Must(json.Marshal(mautrix.MUnrecognized.WithMessage("Invalid method for endpoint"))),
}
r.Handle("/_matrix/key", exhttp.ApplyMiddleware(
r.Handle("/_matrix/key/", exhttp.ApplyMiddleware(
keyRouter,
exhttp.StripPrefix("/_matrix/key"),
exhttp.HandleErrors(errorBodies),
))
}

View file

@ -208,12 +208,14 @@ func (mp *MediaProxy) RegisterRoutes(router *http.ServeMux) {
NotFound: exerrors.Must(json.Marshal(mautrix.MUnrecognized.WithMessage("Unrecognized endpoint"))),
MethodNotAllowed: exerrors.Must(json.Marshal(mautrix.MUnrecognized.WithMessage("Invalid method for endpoint"))),
}
router.Handle("/_matrix/federation", exhttp.ApplyMiddleware(
router.Handle("/_matrix/federation/", exhttp.ApplyMiddleware(
mp.FederationRouter,
exhttp.StripPrefix("/_matrix/federation"),
exhttp.HandleErrors(errorBodies),
))
router.Handle("/_matrix/client/v1/media", exhttp.ApplyMiddleware(
router.Handle("/_matrix/client/v1/media/", exhttp.ApplyMiddleware(
mp.ClientMediaRouter,
exhttp.StripPrefix("/_matrix/client/v1/media"),
exhttp.CORSMiddleware,
exhttp.HandleErrors(errorBodies),
))