From c6bcbc952be67486f08c2b0bbc88cc2ced2f21f3 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Tue, 2 May 2023 13:05:55 -0400 Subject: [PATCH] fix(striker-ui-api): handle static file requests with file extension --- striker-ui-api/src/routes/static.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/striker-ui-api/src/routes/static.ts b/striker-ui-api/src/routes/static.ts index 12585606..414f8195 100644 --- a/striker-ui-api/src/routes/static.ts +++ b/striker-ui-api/src/routes/static.ts @@ -26,8 +26,9 @@ router.use( const parts = originalUrl.replace(/[/]$/, '').split('/'); const tail = parts.pop() || 'index'; + const extended = /[.]html$/.test(tail) ? tail : `${tail}.html`; - parts.push(`${tail}.html`); + parts.push(extended); const htmlPath = path.posix.join(htmlDir, ...parts); const isHtmlExists = existsSync(htmlPath);