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

Rejected Navigation Data Arrays with Blank Items #154

Merged
merged 33 commits into from
Jan 19, 2018
Merged

Conversation

grahammendick
Copy link
Owner

A route of {*x} and navigation data of ['', 'jsfiddle.net'] generated //jsfiddle.net, which equals https://jsfiddle.net. Fixed #153 by rejecting navigation data arrays with blank (null, undefined or '') items.

The error comes when the link's built instead of when it's parsed. This is a change but I don't think it matters? Have to reject empty array items. Arguably could reject blank crumblessUrl earlier - when state context built? But it's v obscure so not worth it
If the array was ['a', ''] then routePath would be a/, but it should be a// to generate blank item when parsed. Now blank items aren't allowed this code isn't needed
The toString() check was meant to block empty strings and empty arrays, but it also blocks [''] because [''].toString() is ''
Removed crumblessCheck in StateHandler now converter handles empty crumblessUrl e.g. r?crumb=
If the url was r?crumb=r&crumb= then this goes into the array vals validation instead of array string and converter already throws error
The crumb urls will always being with / even if the crumbless ones don't because they're built not passed in. For safety's sake, prepended / onto crumbless ones in case someone accesses them directly
@grahammendick grahammendick merged commit 885c253 into master Jan 19, 2018
@grahammendick grahammendick deleted the double-slash branch January 19, 2018 10:52
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

Successfully merging this pull request may close these issues.

1 participant