mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
fix(nuxt): avoid redirect with different encoding and trailing slash (#4857)
Co-authored-by: Pooya Parsa <pyapar@gmail.com>
This commit is contained in:
parent
a58178c4fd
commit
9e5a3cdc6f
@ -59,7 +59,7 @@
|
||||
"pathe": "^0.3.0",
|
||||
"perfect-debounce": "^0.1.3",
|
||||
"scule": "^0.2.1",
|
||||
"ufo": "^0.8.3",
|
||||
"ufo": "^0.8.4",
|
||||
"unctx": "^1.1.4",
|
||||
"unenv": "^0.5.1",
|
||||
"unimport": "^0.1.8",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { reactive, h } from 'vue'
|
||||
import { parseURL, parseQuery, withoutBase } from 'ufo'
|
||||
import { parseURL, parseQuery, withoutBase, isEqual } from 'ufo'
|
||||
import { createError } from 'h3'
|
||||
import { defineNuxtPlugin } from '..'
|
||||
import { callWithNuxt } from '../nuxt'
|
||||
@ -221,7 +221,7 @@ export default defineNuxtPlugin<{ route: Route, router: Router }>((nuxtApp) => {
|
||||
})
|
||||
|
||||
await router.replace(initialURL)
|
||||
if (route.fullPath !== initialURL) {
|
||||
if (!isEqual(route.fullPath, initialURL)) {
|
||||
await callWithNuxt(nuxtApp, navigateTo, [route.fullPath])
|
||||
}
|
||||
})
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
RouteLocation
|
||||
} from 'vue-router'
|
||||
import { createError } from 'h3'
|
||||
import { withoutBase } from 'ufo'
|
||||
import { withoutBase, isEqual } from 'ufo'
|
||||
import NuxtPage from './page'
|
||||
import { callWithNuxt, defineNuxtPlugin, useRuntimeConfig, throwError, clearError, navigateTo, useError } from '#app'
|
||||
// @ts-ignore
|
||||
@ -177,7 +177,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
||||
|
||||
if (process.server) {
|
||||
const currentURL = to.fullPath || '/'
|
||||
if (currentURL !== initialURL) {
|
||||
if (!isEqual(currentURL, initialURL)) {
|
||||
await callWithNuxt(nuxtApp, navigateTo, [currentURL])
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
"postcss-import-resolver": "^2.0.0",
|
||||
"scule": "^0.2.1",
|
||||
"std-env": "^3.1.1",
|
||||
"ufo": "^0.8.3",
|
||||
"ufo": "^0.8.4",
|
||||
"unimport": "^0.1.8"
|
||||
},
|
||||
"engines": {
|
||||
|
@ -42,7 +42,7 @@
|
||||
"postcss-url": "^10.1.3",
|
||||
"rollup": "^2.72.0",
|
||||
"rollup-plugin-visualizer": "^5.6.0",
|
||||
"ufo": "^0.8.3",
|
||||
"ufo": "^0.8.4",
|
||||
"unplugin": "^0.6.2",
|
||||
"vite": "^2.9.8",
|
||||
"vite-node": "^0.10.5",
|
||||
|
@ -42,7 +42,7 @@
|
||||
"postcss-url": "^10.1.3",
|
||||
"style-resources-loader": "^1.5.0",
|
||||
"time-fix-plugin": "^2.0.7",
|
||||
"ufo": "^0.8.3",
|
||||
"ufo": "^0.8.4",
|
||||
"unplugin": "^0.6.2",
|
||||
"url-loader": "^4.1.1",
|
||||
"vue-loader": "^17.0.0",
|
||||
|
16
yarn.lock
16
yarn.lock
@ -1537,7 +1537,7 @@ __metadata:
|
||||
postcss-import-resolver: ^2.0.0
|
||||
scule: ^0.2.1
|
||||
std-env: ^3.1.1
|
||||
ufo: ^0.8.3
|
||||
ufo: ^0.8.4
|
||||
unbuild: latest
|
||||
unimport: ^0.1.8
|
||||
languageName: unknown
|
||||
@ -1651,7 +1651,7 @@ __metadata:
|
||||
postcss-url: ^10.1.3
|
||||
rollup: ^2.72.0
|
||||
rollup-plugin-visualizer: ^5.6.0
|
||||
ufo: ^0.8.3
|
||||
ufo: ^0.8.4
|
||||
unbuild: latest
|
||||
unplugin: ^0.6.2
|
||||
vite: ^2.9.8
|
||||
@ -1699,7 +1699,7 @@ __metadata:
|
||||
postcss-url: ^10.1.3
|
||||
style-resources-loader: ^1.5.0
|
||||
time-fix-plugin: ^2.0.7
|
||||
ufo: ^0.8.3
|
||||
ufo: ^0.8.4
|
||||
unbuild: latest
|
||||
unplugin: ^0.6.2
|
||||
url-loader: ^4.1.1
|
||||
@ -10081,7 +10081,7 @@ __metadata:
|
||||
pathe: ^0.3.0
|
||||
perfect-debounce: ^0.1.3
|
||||
scule: ^0.2.1
|
||||
ufo: ^0.8.3
|
||||
ufo: ^0.8.4
|
||||
unbuild: latest
|
||||
unctx: ^1.1.4
|
||||
unenv: ^0.5.1
|
||||
@ -13231,10 +13231,10 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"ufo@npm:^0.8.3":
|
||||
version: 0.8.3
|
||||
resolution: "ufo@npm:0.8.3"
|
||||
checksum: 7ea20e9d0fbd92b3310de4b020919f0a0542db60a6787ccecf232285d55795ddc0ea482b04d6c07cac60367a294aee705d888999867a5c3c69e47ed8d0ae3009
|
||||
"ufo@npm:^0.8.3, ufo@npm:^0.8.4":
|
||||
version: 0.8.4
|
||||
resolution: "ufo@npm:0.8.4"
|
||||
checksum: a2ebef6f64b9cc4114fc65405837eeb83eb8975edd6d54c7f37abb6905da6fd1f63524e4a02c8b087e7b0b3db6e6f4f798a3d86a96500410ff590b405f807dc9
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user