Skip to content

Double decoding of url params #3138

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

Closed
lyaskovec opened this issue Mar 3, 2020 · 2 comments · Fixed by #3323
Closed

Double decoding of url params #3138

lyaskovec opened this issue Mar 3, 2020 · 2 comments · Fixed by #3323
Labels
bug contribution welcome fixed on 4.x This issue has been already fixed on the v4 but exists in v3

Comments

@lyaskovec
Copy link

Version

3.1.6

Reproduction link

https://lyaskovec.github.io/tests/

Steps to reproduce

There are two cases where you can see issue with double decoding of URL:
case 1:

  • Go to the example page
  • Click on link /%25
  • Click on link /home
  • Try to use browsers navigation buttons

case2:

  • Go to the example page
  • Click on link /%25
  • reload the browser page

What is expected?

It should show a correct page

What is actually happening?

I got "URIError: URI malformed" error

@posva posva added bug contribution welcome fixed on 4.x This issue has been already fixed on the v4 but exists in v3 labels Mar 3, 2020
@aradjdi
Copy link

aradjdi commented Jun 2, 2020

I opened a PR to fix that issue. Can you check it please ? #3213

@souldzin
Copy link

Friendly heads up that we're running into this issue over here in GitLab.

https://gitlab.com/gitlab-org/gitlab/-/issues/233878#note_401932109

Removing decodeURI from getLocation fixes it, but this function seems to be used in a lot of places, so I'm not sure what the consequences of this is 🤔

--- node_modules/vue-router/dist/vue-router.esm.orig.js	2020-08-25 13:49:56.000000000 -0500
+++ node_modules/vue-router/dist/vue-router.esm.js	2020-08-25 13:46:16.000000000 -0500
@@ -2207,7 +2207,7 @@
 }(History));
 
 function getLocation (base) {
-  var path = decodeURI(window.location.pathname);
+  var path = window.location.pathname;
   if (base && path.indexOf(base) === 0) {
     path = path.slice(base.length);
   }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug contribution welcome fixed on 4.x This issue has been already fixed on the v4 but exists in v3
Projects
None yet
4 participants