mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +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
|
||||
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() {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user