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

Simplify extractVars, fixes edge cases. #185

Merged
merged 1 commit into from
Aug 27, 2016
Merged

Simplify extractVars, fixes edge cases. #185

merged 1 commit into from
Aug 27, 2016

Conversation

neelance
Copy link
Contributor

The current implementation was failing in a case where there are two route vars right next to each other and the second one matched the empty string. Because of that, prevEnd < matches[i 1] evaluated to false and the matches got assigned to the wrong names.

Having a capturing regexp group in a route pattern is never useful. This commit changes the tests accordingly. Another option would be to automatically turn capturing groups into non-capturing ones (adding the ?: automatically).

@elithrar elithrar self-assigned this Aug 21, 2016
@elithrar
Copy link
Contributor

Can you add a (pre-fix) failing test case for this?

Also make sure all regexp groups in tests are non-capturing.
@neelance
Copy link
Contributor Author

@elithrar I've added a test which fails before the fix.

@elithrar elithrar merged commit 0b13a92 into gorilla:master Aug 27, 2016
@elithrar
Copy link
Contributor

Thanks for this @neelance!

ldez added a commit to containous/mux that referenced this pull request Oct 20, 2017
juliens pushed a commit to juliens/mux that referenced this pull request Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants