fix(vue-app): decode uri in getlocation (#5337)

This commit is contained in:
Johan Roxendal 2019-03-23 09:40:38 +01:00 committed by Pooya Parsa
parent 71054e5f61
commit 77dcfe6ee8
2 changed files with 3 additions and 4 deletions

View File

@ -259,14 +259,14 @@ export function promisify(fn, context) {
// Imported from vue-router
export function getLocation(base, mode) {
let path = window.location.pathname
let path = decodeURI(window.location.pathname)
if (mode === 'hash') {
return window.location.hash.replace(/^#\//, '')
}
if (base && path.indexOf(base) === 0) {
path = path.slice(base.length)
}
return decodeURI(path || '/') + window.location.search + window.location.hash
return (path || '/') + window.location.search + window.location.hash
}
export function urlJoin() {

View File

@ -19,8 +19,7 @@ describe('unicode-base', () => {
const window = await nuxt.server.renderAndGetWindow(url('/ö/'))
const html = window.document.body.innerHTML
// important to have the actual page transition classes here -> page works, no hydration error
expect(html).toContain('<h1 class="page-enter page-enter-active">Unicode base works!</h1>')
expect(html).toContain('<h1>Unicode base works!</h1>')
})
// Close server and ask nuxt to stop listening to file changes