From f522cdaec436307235b118b70a1e030d806b8142 Mon Sep 17 00:00:00 2001 From: JounQin Date: Fri, 24 Jun 2022 16:26:18 +0000 Subject: [PATCH] fix: check base before redirecting to .html closse #852 --- src/client/app/router.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/app/router.ts b/src/client/app/router.ts index 39418559..8b16fad2 100644 --- a/src/client/app/router.ts +++ b/src/client/app/router.ts @@ -42,7 +42,11 @@ 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')) { + if ( + !url.pathname.endsWith('/') && + !url.pathname.endsWith('.html') && + url.pathname + '/' !== siteDataRef.value.base + ) { url.pathname += '.html' href = url.pathname + url.search + url.hash }