3.0.3
Sorry, It is hard to supply a minimal reproduction
Visit http://a.b.c/#/test?d=%25
Vue-router will throw a warning URIError: URI malformed, and abandon all the query params.
DecodeURI once is enough.
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.
Relevant post in forum:
https://forum.vuejs.org/t/vue-router-decodes-uri-twice-creates-errors-when-are-in-params/56685
Indeed, we should not decode the search nor the hash in hash mode
@posva When this fix will be released?
@posva When this fix will be released?
Has released in 3.0.4 https://github.com/vuejs/vue-router/commit/81cfe71296caa5cde21f780ece1910b172b8e5f7 .
Thanks for fast response, i guess i have similar but diffrent issue
URIError: URI malformed
at decodeURIComponent (<anonymous>)
at matchRoute (<deleted>/node_modules/vue-router/dist/vue-router.common.js:1530:42)
```
for (var i = 1, len = m.length; i < len; ++i) {
var key = regex.keys[i - 1];
console.log(m[i]);
var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
if (key) {
// Fix #1994: using * with props: true generates a param named 0
params[key.name || 'pathMatch'] = val;
}
}
````
value that triggers error: product/100-%-polipropylen-–-bcf
Check #2725
BTW % is not a valid character in a url (per spec). You have to use the escaped version %25
Thanks alot!
Most helpful comment
Has released in 3.0.4 https://github.com/vuejs/vue-router/commit/81cfe71296caa5cde21f780ece1910b172b8e5f7 .