Regex match reference not working in controller tuples in custom routes #336

Open
zachgarwood opened this Issue Oct 10, 2013 · 1 comment

Comments

Projects
None yet
4 participants

In the priv/[app].routes file, when creating a custom route and using a regex to match parts of the url, putting the '$1' match reference atom in the controller tuple (ie. {controller, '$1'}) does not route to the desired controller.

I noticed that this tuple, in addition to routing correctly if an explicit string is used ({controller, "desired_controller"}), will also route correctly if an atom is used ({controller, desired_controller}). There seems to be a atom_to_list conversion happening somewhere in the bowels of the framework that may be converting the '$1' match reference to "$1" during routing.

Contributor

evanmiller commented Nov 11, 2013

Close, but not quite. What's happening is that the action, application, and controller parameters are treated separately from all other parameters, and do not participate in the variable substitution. See around

https://github.com/evanmiller/ChicagoBoss/blob/master/src/boss/boss_router_controller.erl#L128

I'm open to changing this behavior but it does seem to be inviting trouble.

zkessin was assigned Jan 7, 2014

zkessin was unassigned by danikp Oct 11, 2015

danikp added the routing label Oct 11, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment