-
Notifications
You must be signed in to change notification settings - Fork 692
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
regex route path allows partial match #545
Comments
After dig into the code, I think the key is in my example setup, helloRegex := regexp.MustCompile("(?i)hello")
matches := helloRegex.FindStringSubmatch("xxxhello")
log.Println(matches) // []string{"hello"} |
did find a workaround by using more strict regex |
send PR with example on how to handle this issue safely #546 |
thank you for reporting this issue and investigating the problem. I will have a look at the PR. |
thanks for merging the example PR, hopefully that will help someone. As a library, I think we want to prevent caller from make mistakes and cause misroute, can we consider have regex to match the whole routeToken with next minor release where you can introduce break changes. |
to accept case-insensitive paths, we use
{h:(?i)hello}
, to accept /HELLO, /hello, /Hello.but with this approach, it also triggered a bug where /xxxHello, /yyyHello also got accepted.
The text was updated successfully, but these errors were encountered: