mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
fix(nuxt): don't redirect if initial path has trailing slash (#22192)
This commit is contained in:
parent
fed5868184
commit
b8a282e115
@ -9,7 +9,7 @@ import {
|
||||
createWebHistory
|
||||
} from '#vue-router'
|
||||
import { createError } from 'h3'
|
||||
import { withoutBase } from 'ufo'
|
||||
import { isEqual, withoutBase } from 'ufo'
|
||||
|
||||
import type { PageMeta, Plugin, RouteMiddleware } from '../../../app/index'
|
||||
import { defineNuxtPlugin, useRuntimeConfig } from '#app/nuxt'
|
||||
@ -42,7 +42,8 @@ function createCurrentLocation (
|
||||
if (pathFromHash[0] !== '/') { pathFromHash = '/' + pathFromHash }
|
||||
return withoutBase(pathFromHash, '')
|
||||
}
|
||||
const path = renderedPath || withoutBase(pathname, base)
|
||||
const displayedPath = withoutBase(pathname, base)
|
||||
const path = !renderedPath || isEqual(displayedPath, renderedPath, { trailingSlash: true }) ? displayedPath : renderedPath
|
||||
return path + (path.includes('?') ? '' : search) + hash
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user