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

Suggestion - ignore case when providing controller and action names #34

Closed
ExigoOffice opened this issue Sep 5, 2014 · 6 comments
Closed

Comments

@ExigoOffice
Copy link

My preference has always been to use a custom route provider that auto-lowercases my routes. I see that the routes are case-sensitive, but seeing as how the casing is not a factor in the @Url.Action and other helper methods, it might help if the casing could be ignored.

Thoughts?

@ExigoOffice
Copy link
Author

Bump :)

@Daniel15
Copy link
Owner

Daniel15 commented Sep 9, 2014

Hey @ExigoOffice - Sorry it took me a while to reply. This was in my queue of things to look at :P

I think making it case sensitive is a good idea. Is ASP.NET MVC actually case sensitive with its routes? Could you have two routes that differ only by casing?

@ExigoOffice
Copy link
Author

No, the routes cannot be the same based on their content. Casing is ignored.

@Daniel15
Copy link
Owner

I've just released 1.1.8 which treats controllers, actions, areas, and the keys of parameters as case insensitive. Thanks for the bug report!

@boerbiet
Copy link

I found out this change breaks some functionality on our site after a colleague updated from 1.1.7 to 1.1.8. For example:

C#

routes.MapRoute("Arbitrary Route", "path/{variableThing}/etc/", new { controller = "X", action = "Y" }, new { variableThing = "Z" });

JS

Router.Action('X', 'Y', { variableThing: 'Z' });

Now when the constraints are parsed, the key variable will be "variableThing". The objects however:

parsedConstraints['variableThing'] = /^(Z)/

routevalues['variablething'] = 'Z'

Due to the lower case key the route will not match. Maybe it's intended behaviour, maybe it's an oversight, but I think it should either be addressed or mentioned in the documentation. I'll discuss with my colleagues whether or not we should go all lower case on constraint keys or downgrade to 1.1.7.

@Daniel15
Copy link
Owner

Definitely sounds like an oversight. Can you please create a separate issue
for it? I can fix this weekend (or sooner if I get some free time). Thanks!

Regards,
Daniel Lo Nigro
http://dan.cx/ | Twitter http://twitter.com/Daniel15 | Facebook
http://www.facebook.com/daaniel

On Tue, Jan 13, 2015 at 11:39 PM, boerbiet notifications@github.com wrote:

I found out this change breaks some functionality on our site after a
colleague updated from 1.1.7 to 1.1.8. For example:

C#

routes.MapRoute("Arbitrary Route", "path/{variableThing}/etc/", new { controller = "X", action = "Y" }, new { variableThing = "Z" });

JS

Router.Action('X', 'Y', { variableThing: 'Z' });

Now when the constraints are parsed, the key variable will be
"variableThing". The objects however:

parsedConstraints['variableThing'] = /^(Z)/

routevalues['variablething'] = 'Z'

Due to the lower case key the route will not match. Maybe it's intended
behaviour, maybe it's an oversight, but I think it should either be
addressed or mentioned in the documentation. I'll discuss with my
colleagues whether or not we should go all lower case on constraint keys or
downgrade to 1.1.7.

Reply to this email directly or view it on GitHub
#34 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants