mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-18 14:41:25 +00:00
fix(vue-app): decode uri in getlocation
(#5337)
This commit is contained in:
parent
71054e5f61
commit
77dcfe6ee8
@ -259,14 +259,14 @@ export function promisify(fn, context) {
|
|||||||
|
|
||||||
// Imported from vue-router
|
// Imported from vue-router
|
||||||
export function getLocation(base, mode) {
|
export function getLocation(base, mode) {
|
||||||
let path = window.location.pathname
|
let path = decodeURI(window.location.pathname)
|
||||||
if (mode === 'hash') {
|
if (mode === 'hash') {
|
||||||
return window.location.hash.replace(/^#\//, '')
|
return window.location.hash.replace(/^#\//, '')
|
||||||
}
|
}
|
||||||
if (base && path.indexOf(base) === 0) {
|
if (base && path.indexOf(base) === 0) {
|
||||||
path = path.slice(base.length)
|
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() {
|
export function urlJoin() {
|
||||||
|
@ -19,8 +19,7 @@ describe('unicode-base', () => {
|
|||||||
const window = await nuxt.server.renderAndGetWindow(url('/ö/'))
|
const window = await nuxt.server.renderAndGetWindow(url('/ö/'))
|
||||||
|
|
||||||
const html = window.document.body.innerHTML
|
const html = window.document.body.innerHTML
|
||||||
// important to have the actual page transition classes here -> page works, no hydration error
|
expect(html).toContain('<h1>Unicode base works!</h1>')
|
||||||
expect(html).toContain('<h1 class="page-enter page-enter-active">Unicode base works!</h1>')
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
|
Loading…
Reference in New Issue
Block a user