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

Library does not properly decode dynamic segment from utf-8 route #145

Open
estshy opened this issue Sep 14, 2018 · 4 comments
Open

Library does not properly decode dynamic segment from utf-8 route #145

estshy opened this issue Sep 14, 2018 · 4 comments

Comments

@estshy
Copy link

estshy commented Sep 14, 2018

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.

image
image
image

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 estshy changed the title Library does not properly decode utf-8 dynamic segment from utf-8 route Library does not properly decode dynamic segment from utf-8 route Sep 14, 2018
@rwjblue
Copy link
Collaborator

rwjblue commented Nov 27, 2018

@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?

@bantic
Copy link
Contributor

bantic commented Nov 28, 2018

@rwjblue No worries, thanks for the ping. I'll take a look at this and give some ideas.

@bantic
Copy link
Contributor

bantic commented Nov 29, 2018

@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.

@estshy
Copy link
Author

estshy commented Dec 4, 2018

@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.

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

No branches or pull requests

3 participants