-
Notifications
You must be signed in to change notification settings - Fork 87
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
fix: filter with special characters #885
Conversation
@MoritzRS Following https://stackoverflow.com/a/747700 using But I wonder: Normally, Angular should take care of encoding and decoding the params properly, so why do we have to do it here at all? I suspect there is a wrong |
I also found this suspicious that you have to decode at all. I will look into this and see if I find that encoding part. Thanks for replying |
The request at https://pwa-ish-demo.test.intershop.com/INTERSHOP/rest/WFS/inSPIRED-inTRONICS-Site/rest;loc=en_US;cur=USD/productfilters?searchTerm=* already returns the encoded string. So "/" is already encoded as "%2F" when angular receives the possible filter options |
@MoritzRS That means, we just have to If I follow the mapping, it happens here:
So if we look at this line in the
The decoding can happen with Does that sound plausible? |
Seems good to me and works just as expected. Thanks 😄 |
Worked for the brand filter only but breaks every other Filter. First commit worked for me with all other filters but I'll do some tests before reverting. |
@MoritzRS No, please don't revert, we only go forward! 😄 As far as I can see, it only doesn't work for prices, because they use range instructions and also have encoded keys, so they also must be decoded and the line should become:
|
Should work by now. Thanks for your help 😄 I'll do my best to verify changes are working before committing in the future so we don't always have this back and forth over such little changes 😅 |
No worries, that's what these collaboration tools are built for. It just takes a little bit longer 😉👍 |
PR Type
[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no API changes)
[ ] Build-related changes
[ ] CI-related changes
[ ] Documentation content changes
[ ] Application / infrastructure changes
[ ] Other:
What Is the Current Behavior?
When applying search filter with characters like "&" or "/" leads to false encodet parameters in the rest request.
What Is the New Behavior?
When applying search filter with special characters, parameters are encodet properly.
Does this PR Introduce a Breaking Change?
[ ] Yes
[x] No
Other Information
The change from decodeURI to decodeURIComponent works for the filters, but wasn't tested enough and might lead to unexpected behavior elsewhere.