-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix(UrlMatcherFactory): Correct trailing slash of terminal optional parameter #2198
Conversation
Thanks jshado1 Does this perform symmetrically, i.e., does it also match properly when the trailing slashes are omitted? Can you address those issues and push an updated PR? I'd like to see additional unit tests for more combinations, with the above questions in mind accounting for:
|
@@ -342,6 +342,8 @@ UrlMatcher.prototype.format = function (values) { | |||
|
|||
if (isPathParam) { | |||
var nextSegment = segments[i + 1]; | |||
var isFinalPathParam = i + 1 >= nPath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should probably be changed to i + 1 === nPath
(isPathParam
already ensures that this is within nPath
).
I think there're other tests that (inadvertently?) assert cases 1 and 2. I'll look for them. Is it safe to assume that param.squash will inherit Thanks for the feedback. |
That should really only apply to parsing.
https://github.com/jshado1/ui-router/blob/1902/src/urlMatcherFactory.js#L202 @jshado1 If you wanna make the change you noted above and squash your commits, this is 👍 from me. Thanks for your work on this! |
@christopherthielen, non-optional is covered by urlMatcherFactorySpec.js#L617.
Possibly lacking caffeine, but what is "it" ? @nateabele will do when i get home tonight. |
638b536
to
77fa11b
Compare
@nateabele I made that change I had commented on (and squashed). |
Regarding my symmetry comment, I want to make sure that if strict mode is on and a url is generated (with trailing slash removed), that the url will then be matched correctly to the same state and paeans (for instance if the user hits reload in the browser) |
fix(UrlMatcherFactory): Correct trailing slash of terminal optional parameter
Fixes #1902