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

Routes with mixed inline regexs and tokens #1642

Open
veryrusty opened this issue Feb 28, 2022 · 0 comments
Open

Routes with mixed inline regexs and tokens #1642

veryrusty opened this issue Feb 28, 2022 · 0 comments
Labels

Comments

@veryrusty
Copy link
Member

veryrusty commented Feb 28, 2022

When working on #1641, I planned on adding a test case for get '/(any|some)/thing/:id => sub {...}; to t/classes/Dancer2-Core-Route/match.t, which fails :(

+    [
+        [ 'get', '/(any|some)/thing/:id', sub {61} ],
+        '/some/thing/else',
+        [ { id => 'else', splat => ['some'] }, 61 ]
+    ],

The route matching code extracts the values some and else from the path; but the route regexp only has one regex with a comment. The token assignment iterates through the regex captures starting with those with comments first, assigning the rest to splat. This results in the params { id => 'some', splat => ['else'] } .. which is just wrong.

After some though, I still do not have a way to "fix" this. Creating this issue as a reminder to myself, or in hope someone else may pick it up 🤞 .

@cromedome cromedome added the Bug label Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants