Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with # in route matching #429

Open
DoLolitingyu opened this issue Apr 17, 2020 · 1 comment
Open

Problems with # in route matching #429

DoLolitingyu opened this issue Apr 17, 2020 · 1 comment

Comments

@DoLolitingyu
Copy link

LIke:
m.Get("/hello/**", func(params martini.Params) string {
return "Hello " + params["_1"]
})

Enter when I visit “/hello/test#test”, It's return 404.
I want to know # is treated as something else?
Thank you ^-^

@jerbob92
Copy link

I believe I have fixed this in my fork:
master...klippa-app:martini:master

Basically Martini does path matching on the decoded version of the URL. In that matching it handles a few characters as path delimiters, like # and /. If your path contains encoded values of these (%23 and %2F), it will show up as decoded in the matching code of Martini and it will not match them on your route.

My changes will match the route on the encoded version of the URL (using req.URL.EscapedPath()), and will then decode the path segments later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants