-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix path support after unlimited optional placeholders
When using a route which contains both an unlimited optional placeholder, and another optional placeholder afterwards, the incorrect values are collected. For example, given the following route: ``` /go/to/[{location:.*}[/info/{subpage}]] ``` The following behaviour is currently observed: - route: `/go/to/[{location:.*}[/info/{subpage}]]` - url: `/go/to/australia/perth/info/about` - location: `'australia/perth/info/about'` - subpage: `''` Note that the `location` contains `/info/about` and the `subpage` is empty. This is inconsistent with the behaviour where an unlimited value is _not_ used: - route: `/go/to/[{location}[/info/{subpage}]]` - url: `/go/to/australia/info/about` - location: `'australia'` - subpage: `'about'` In the case of the unlimited optional path, the expected behaviour is: The correct value would be: - route: `/go/to/[{location:.*}[/info/{subpage}]]` - url: `/go/to/australia/perth/info/about` - location: `'australia/perth'` - subpage: `'about'` This commit change updates the route dispatcher to reverse the order of the routes when adding routes to the router, which brings the unlimited path placeholder format inline with limited path placeholders. Signed-off-by: Andrew Nicols <[email protected]>
- Loading branch information
1 parent
d3ada01
commit 37f2f19
Showing
5 changed files
with
65 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters