question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vue-router decodeURI twice cause URL contains encoded % an URIError: URI malformed

See original GitHub issue

Version

3.0.3

Reproduction link

Sorry, It is hard to supply a minimal reproduction

Steps to reproduce

Visit http://a.b.c/#/test?d=%25 Vue-router will throw a warning URIError: URI malformed, and abandon all the query params.

What is expected?

DecodeURI once is enough.

What is actually happening?

DecodeURI twice.


ref: https://github.com/vuejs/vue-router/blob/627027fd4351c1a6fa4926765c805165a56d7818/src/history/hash.js#L100-L106 https://github.com/vuejs/vue-router/blob/627027fd4351c1a6fa4926765c805165a56d7818/src/util/query.js#L37-L63

The getHash method already decoded href, but parseQuery decode it again. So caused URIError: URI malformed. Maybe decoding in getHash is not necessary.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
posvacommented, Apr 19, 2019

Check #2725

BTW % is not a valid character in a url (per spec). You have to use the escaped version %25

3reactions
hq5544commented, Apr 19, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

URIError: malformed URI sequence - MDN Web Docs - Mozilla
URIError : malformed URI sequence. The JavaScript exception "malformed URI sequence" occurs when URI encoding or decoding wasn't successful.
Read more >
issue when % character is in url - Stack Overflow
It looks to me like you are encoding characters in your URL twice and then trying to decode them. %2525%2525PAGE%2525%2525 decodes to %25%25PAGE ......
Read more >
Vue router decodes URI twice, creates errors when % are in ...
I have worked around this by overriding the parseQuery function in my router to a copy of the default but without any decodes...
Read more >
How to Fix Uncaught URIError: URI malformed Errors in JS
Here we are trying to encode an invalid Unicode character. The reason this is invalid for encoding is that the Unicode code range...
Read more >
Uri Malformed, Cannot Be Parsed - While Connecting To ...
between URI and URL which service using port 80 command org.apache.http. ... encoded contains invalid character Edge URIError: malformed URI ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found