go-chi / go-chi/chi

middleware.CleanPath doesn't work with other routers

Open
#787 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
22.8k
Forks
1.2k
Avg merge
5h 17m
Merged PRs (30d)
10

Description

The rctx is not checked and could be nil if the function isn't used with a chi.Router.
It ends up in a panic.

PR: #786

Additional point: the cleaning only happens in the rctx.RoutePath is an empty string. If a function like [GetHead](https://github.com/go-chi/chi/blob/v1.5.4/middleware/get_head.go#L10) [¶](https://pkg.go.dev/github.com/go-chi/chi/middleware#GetHead) is called before it won't clean the path.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.