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

Decode route before parsing. #70

Closed

Conversation

tundal45
Copy link

Since the route recognizer matchrecognize supports decoding before the match,
it makes sense for the parser to also decode URI components before
it starts parsing the route.

This should solve pretenderjs/pretender#124.

While the test I added failed both in chrome & phantomjs, this might
also be relevant to pretenderjs/pretender#111.

Since the route recognizer match supports decoding before the match,
it makes sense for the parser to also decode URI components before
it starts parsing the route.

This should solve pretenderjs/pretender#124.

While the test I added failed both in chrome & phantomjs, this might
also be relevant to pretenderjs/pretender#111.
@tundal45
Copy link
Author

Hi! I was wondering if there is any feedback on this PR.

@@ -88,6 +88,8 @@ EpsilonSegment.prototype = {
function parse(route, names, specificity) {
// normalize route as not starting with a "/". Recognition will
// also normalize.
route = decodeURIComponent(route);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would decode special URI characters before parsing, so an encoded slash would get parsed as a path separator, decodeURIComponent should not happen before parsing, decodeURI is for normalizing a URI so that all the optionally encoded characters are decoded.

@krisselden
Copy link
Collaborator

Superseded by #55 which is fixing all of the encoding issues in a more holistic manner.

@krisselden krisselden closed this Apr 25, 2016
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.

None yet

2 participants