From 84b1eafb79a7f47d6c899faec601e3639d04d717 Mon Sep 17 00:00:00 2001 From: Raunak Raj <71929976+bajrangCoder@users.noreply.github.com> Date: Fri, 16 Jan 2026 20:16:51 +0530 Subject: [PATCH 1/2] feat: extensionless URL resolution in preview server Links like now resolve to about.html or about/index.html Fixes: #1739 --- src/lib/run.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/lib/run.js b/src/lib/run.js index b6dcc02b1..fc9014b5f 100644 --- a/src/lib/run.js +++ b/src/lib/run.js @@ -256,6 +256,33 @@ async function run( file = activeFile; } + // Handle extensionless URLs (e.g., "about" -> "about.html" or "about/index.html") + if (!ext && pathName) { + // Try path.html first + const htmlUrl = Url.join(pathName, reqPath + ".html"); + const htmlFile = editorManager.getFile(htmlUrl, "uri"); + if (htmlFile?.loaded && htmlFile.isUnsaved) { + sendHTML(htmlFile.session?.getValue(), reqId); + return; + } + const htmlFs = fsOperation(htmlUrl); + if (await htmlFs.exists()) { + sendFileContent(htmlUrl, reqId, MIMETYPE_HTML); + return; + } + + // Try path/index.html + const indexUrl = Url.join(pathName, reqPath, "index.html"); + const indexFs = fsOperation(indexUrl); + if (await indexFs.exists()) { + sendFileContent(indexUrl, reqId, MIMETYPE_HTML); + return; + } + + error(reqId); + return; + } + switch (ext) { case ".htm": case ".html": From 957a0f1de2dcf8d38a6722d0be9f493233bd7c4d Mon Sep 17 00:00:00 2001 From: Raunak Raj <71929976+bajrangCoder@users.noreply.github.com> Date: Fri, 16 Jan 2026 20:35:34 +0530 Subject: [PATCH 2/2] fix --- src/lib/run.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/run.js b/src/lib/run.js index fc9014b5f..85df583c8 100644 --- a/src/lib/run.js +++ b/src/lib/run.js @@ -258,7 +258,15 @@ async function run( // Handle extensionless URLs (e.g., "about" -> "about.html" or "about/index.html") if (!ext && pathName) { - // Try path.html first + // Try exact match first for extensionless files (LICENSE, README, etc.) + const exactUrl = Url.join(pathName, reqPath); + const exactFs = fsOperation(exactUrl); + if (await exactFs.exists()) { + sendFile(exactUrl, reqId); + return; + } + + // Try path.html const htmlUrl = Url.join(pathName, reqPath + ".html"); const htmlFile = editorManager.getFile(htmlUrl, "uri"); if (htmlFile?.loaded && htmlFile.isUnsaved) {