fix(client): base not stripped from relativePath in 404 pages

closes #4850
pull/4868/head
Divyansh Singh 2 months ago
parent 51f7fda0bd
commit b840877aa8

@ -159,10 +159,10 @@ export function createRouter(
route.path = inBrowser ? pendingPath : withBase(pendingPath) route.path = inBrowser ? pendingPath : withBase(pendingPath)
route.component = fallbackComponent ? markRaw(fallbackComponent) : null route.component = fallbackComponent ? markRaw(fallbackComponent) : null
const relativePath = inBrowser const relativePath = inBrowser
? pendingPath ? route.path
.replace(/(^|\/)$/, '$1index') .replace(/(^|\/)$/, '$1index')
.replace(/(\.html)?$/, '.md') .replace(/(\.html)?$/, '.md')
.replace(/^\//, '') .slice(siteDataRef.value.base.length)
: '404.md' : '404.md'
route.data = { ...notFoundPageData, relativePath } route.data = { ...notFoundPageData, relativePath }
syncRouteQueryAndHash(targetLoc) syncRouteQueryAndHash(targetLoc)

Loading…
Cancel
Save