From 69c477358591e23796de028cac86c31ea330d904 Mon Sep 17 00:00:00 2001 From: JounQin Date: Fri, 24 Jun 2022 16:52:37 +0000 Subject: [PATCH] fix: use redirect instead --- src/client/app/router.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/client/app/router.ts b/src/client/app/router.ts index 8b16fad2..910d8163 100644 --- a/src/client/app/router.ts +++ b/src/client/app/router.ts @@ -42,12 +42,9 @@ export function createRouter( function go(href: string = inBrowser ? location.href : '/') { // ensure correct deep link so page refresh lands on correct files. const url = new URL(href, fakeHost) - if ( - !url.pathname.endsWith('/') && - !url.pathname.endsWith('.html') && - url.pathname + '/' !== siteDataRef.value.base - ) { - url.pathname += '.html' + if (!url.pathname.endsWith('/') && !url.pathname.endsWith('.html')) { + url.pathname += + url.pathname + '/' === siteDataRef.value.base ? '/' : '.html' href = url.pathname + url.search + url.hash } if (inBrowser) {