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

Invalid route generation with multiple parameters #318

Open
ridercz opened this issue Feb 14, 2017 · 7 comments
Open

Invalid route generation with multiple parameters #318

ridercz opened this issue Feb 14, 2017 · 7 comments

Comments

@ridercz
Copy link
Contributor

ridercz commented Feb 14, 2017

My route is defined as follows:

config.RouteTable.Add("Calendar", 
    "kalendar/{Year:posint}/{Month:posint}",
    "Views/Calendar.dothtml", 
    new { Year = 0, Month = 0 });

I'm calling it from RouteLink control:

<dot:RouteLink RouteName="Calendar" Param-Month="" Param-Year="">...</dot:RouteLink>

The resulting URL is /kalendar// instead of just /kalendar/.

@exyi
Copy link
Member

exyi commented Feb 15, 2017

It seems to be correct behavior - you are passing an empty string to the parameter. Maybe we could just validate the parameter for posint constraint.

@tomasherceg
Copy link
Member

I think we should replace sequences of multiple slashed with just one slash in the URL and make sure that it will match the route correctly.
This should work the same as in MVC, so we should do a research how this thing works there and then adjust the behavior to be the same in DotVVM.

@exyi
Copy link
Member

exyi commented Feb 15, 2017

Removing double slash would not help: /kalendar// - Year is not integer, /kalendar/ - argument is missing.

I have just tried what MVC does and it says that no matching route was found, when the values are empty. If the route parameters would be optional, MVC returns /kalendar.

@tomasherceg
Copy link
Member

We need someone to do a research of these situations and compare how MVC and DotVVM behaves.
After we have the table of differences, we should decide how to adjust the mechanism.

@tomasherceg
Copy link
Member

@exyi You were fixing something in the RouteLink control and if I remember correctly, you discovered some issues related to this - is this issue still relevant?

@exyi
Copy link
Member

exyi commented Jan 21, 2021

No, i have not added a step to remove double slashes

@tomasherceg tomasherceg modified the milestones: Version 4.0, Future Jul 20, 2021
@tomasherceg
Copy link
Member

We've discussed this and we can validate the parameter constraints when generating the link (when the page is compiled), and maybe generate warnings when the parameter is data-bound.

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

No branches or pull requests

3 participants