-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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: remove duplicated decodeURIComponent #3323
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! It still has a few breaking things that need to be fixed
I've added the restrictions you have proposed and solved the differences. The point was that when initially executes the application the route path was decoded (obtains the URL from the browser); whilst when changed the route from inside the application it was encoded (via clicking router-link). This fact is what initially produces the decoding error on initially load (issue #2725), because it tried to decode an already decoded URL. I have assumed that the URL used as 'to' param in router-link must be decoded and it worked. As it can be checked in the test, when changing the route via clicking a router-link which has defined a decoded URL the application URL is properly encoded, so I assume it is right. Thank you for your comments. |
That's the issue though, |
Ok @posva, thank you very much for you attention. Can I help in any way? or it is up to you checking the changes in old browsers? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the only changes in terms of tests that need to be done. The other assertions setup in e2e tests are correct
After doing some research, coding and testing I found out the following: The URL got from window.location was decoded, as it can be seen in html5.js and hash.js. But, I cannot see where the URL got from the "to" attribute of router-link is decoded, neither on push, replace, ... methods. As posva said before, the mentioned attribute should be encoded, so I presume that the internal URL was different (encoded or not) depending on the way to access the route. If the application has initially load, the internal URL was decoded, but when change the route without reloading the page, the URL was encoded. This point caused the duplication decodeURIComponent, which is the core of the issue. In order to fix this I have made the following changes:
With these changes all tests works. If I can help you in any way I would be glad to do it. |
Thanks a lot, I think this is starting to look good. Sorry, it's taking some time, I must make sure it doesn't break existing code. So far, it's working well on all my tests. One thing I need to add is the application not to crash when the URL is malformed (happens on old browsers like IE9 on |
I'm glad he have finally managed to fix the issue successfully! One more thing, what is the protocol or schedule to publish a new release? I am looking forward to finally installing it on my project and close the issues. Many thanks |
I still need to fix a few introduced problems and will likely release it next week |
I just installed The error:
This happens when a user refreshes the page. |
@jaapio you need to build vue-router to update the |
Will check that |
This change breaks existing behavior. I have a route like Before v3.4.6, it decoded the server param to: |
Still duplicating decodeURI in case of regex path. I found this code in function matchRoute:
When second decoding fails, function return false and route can not be matched. I think code must be edited like this:
|
Thanks @Dmitry-k42 |
As it is mentioned by @claudiocastro I proposed the change made at #3268 adding some e2e tests, in order to get the fix merged. This change is a fix for the #2725 issue.
Before this change the URL such as:
Produced an initial error:
And recursive errors:
Fix change fix the issue and other test cases still pass.
Best regards
Close #2725
Close #3268
Close #3138