You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
urlFor() / linkTo() fails outbound route generation for namespaced controllers without explicit route names #4695
Describe the bug
When using nested controller directories inside a .namespace() block with dynamic [action] routing, inbound routing works as expected, but outbound link generation (urlFor / linkTo) fails to parse the controller package context correctly.
Instead of generating clean forward-slash delimited paths (e.g., /admin/users/show/1), CFWheels produces malformed URLs containing hyphenated slugs (e.g., /admin.-users/show/1) or double-encoded entities (e.g., %2-f) unless an explicit name="" parameter is assigned to the route.
To Reproduce
Steps to reproduce the behavior:
Define an unnamed generic route inside a namespace (config/routes.cfm):
Workaround
Adding an explicit name attribute to the generic route pattern inside routes.cfm bypasses the internal package-guessing logic and allows outbound link generation to resolve cleanly:
.namespace("admin")
// Explicitly naming the generic route resolves the issue
.get(name="UsersKey", pattern="users/[action]/[key]", to="users##[action]")
.end()
<!--- Works correctly with explicit route name. Note that the action="show"
is just a regular variable here like key. It's not the internal wheels action.
As far as I can tell at least. --->
#linkTo(route="adminUsersKey", action="show", key=1)#
Activity