route-recognizer
route-recognizer copied to clipboard
Library does not properly decode dynamic segment from utf-8 route
this.route('worker', {
path: 'praca-sprzątanie'
}, function () {
this.route('city', {
path: 'kczewo'
});
});
When going on praca-sprzątanie/kczewo, route is properly recognized but dynamic segement is passed down as null. Code does behave correctly with ENCODE_AND_DECODE_PATH_SEGMENTS
turned off.
Problem comes down to fact that originalPath
is not decoded anyhow but later on it's used inside regular expression.
Is there any way to overwrite ENCODE_AND_DECODE_PATH_SEGMENTS
flag from ember application till the issue will be resolved?
Issue was observed on ember 3.4.0
@estshy - Can you attempt to submit a failing test case for this? It would almost certainly make fixing much easier...
@bantic - Sorry to pester you here, but I recall you fixing a few related issues here a while back and was wondering if you happen to have a pointer to where to start digging?
@rwjblue No worries, thanks for the ping. I'll take a look at this and give some ideas.
@estshy Can you give some more details to help reproduce the issue you're seeing?
this.route('worker', { path: 'praca-sprzątanie' }, function () { this.route('city', { path: 'kczewo' }); });
This router snippet that you provided above doesn't have any dynamic segments. It instructs the router to recognize the static path "/praca-sprzątanie/kczewo". This static path seems to work fine. Here's a Twiddle that shows it working. Clicking the link (or pasting in the path directly to the twiddle's address bar) correctly takes you to the worker/city route and displays the template.
I created a second twiddle that has a dynamic segment for worker
and city
. It also appears to recognize your path ok. Clicking the link (or pasting path in directly) takes you to the worker/city route with the worker
and city
dynamic segments properly populated.
Let me know if I misunderstood the issue that you ran into.
@bantic At the moment I am not able to reproduce the issue on twiddle and I am not sure why. I will get back to you with a failing test case when I will have more time to dig into it. For now I made workaround by extracting the missing parameter from url manually.