-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
hash decode not match the later encode #2187
Comments
The inconsistency in So technically, this is fixable with #2189 but I wouldn't rely on |
* fix: avoid normalizing the fullPath Close #2187 * test: add test
I had to revert this because it breaks other behaviors... This will be a wontfix until we use URL |
@posva i would like to note, that normalization of hashes breaks Telegram Mini App's refresh button, since it stores auth data in URL hash. So probably this issue should be prioritized higher than "wontfix" |
Reproduction
https://jsfiddle.net/qhn7gka8/
Steps to reproduce the bug
/test#/?redirect=%2F%3Fid%3D1%23%2Fabc
(just`/test#/?redirect=${encodeURIComponent('/?id=1#/abc')}`
)/test#/?redirect=/?id=1#/abc
, that's unexpectedpush
works well.Expected behavior
the hash of route remain its original encode
Actual behavior
hash's original encode lost
Additional information
posible reason.
The hash part of route is decode in the
parseURL
function.router/packages/router/src/location.ts
Line 89 in 4e82939
decode
usesdecodeURIComponent
, which would decode the/?
.After doing a
replace
action, it callsparseURL
first, and then callsresolve(to)
later.router/packages/router/src/router.ts
Line 657 in 4e82939
In function
resolve
, hash is encode.However,
encodeHash
useencodeURI
indexofencodeURIComponent
, so the hash would never be encoded to the original hash if there's characters/?
in it.router/packages/router/src/router.ts
Line 531 in 4e82939
router/packages/router/src/encoding.ts
Line 72 in 4e82939
Maybe
decode(hash)
in functionparseURL
should usedecodeURI
instead ofdecodeURIComponent
.see #2060 and its pr #2061
The text was updated successfully, but these errors were encountered: