Fix encoding/decoding inconsistency when using values that need scaping #33
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since
makePath
usespathToRegexp
which in place usesencodeURIComponent
for all values, when getRoute tries to match a URL generated by the router itself, it returns a double enconded value.I suspect this is the root cause for fluxible-router to avoid using parsed URLs and bookeeping the origURL instead.
I added tests to both
match
(indirectly throughgetRoute
) and tomakePath
. Notice that if you comment or removedecodeURIComponent
from the implementation, only 1 of the tests fails. This proves the undesired inconsistency.I do hate JSON in URLs and I know it is a bad practice, and I do want to remove this from the application I am working on (nope, I didn't introduce in the first place). But I believe this to be beneficial to the router... who does not want to support
/emoji/😍/used/in/paths
?@mridgway