Skip to content
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: handle route encoding #8325

Merged
merged 22 commits into from
Nov 30, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
encode path before return
  • Loading branch information
pi0 committed Nov 9, 2020
commit cf68806cfd6403bf3d31f20a51613b435280d1fc
5 changes: 4 additions & 1 deletion packages/vue-app/template/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,16 @@ export function getLocation (base, mode) {
return window.location.hash.replace(/^#\//, '')
}

let path = window.location.pathname
let path = decodeURI(window.location.pathname)

// To get matched with sanitized router.base add trailing slash
if (base && (path.endsWith('/') ? path : path + '/').startsWith(base)) {
path = path.slice(base.length)
}

// https://github.com/vuejs/vue-router/pull/3350
path = encodeURI(path)

return (path || '/') + window.location.search + window.location.hash
}

Expand Down