very simple nav setup to support sandbox mode

This commit is contained in:
Will Chen
2025-04-12 22:34:11 -07:00
parent 39565ce6d2
commit 9f8302a0b8
2 changed files with 43 additions and 11 deletions

View File

@@ -115,9 +115,13 @@ const handleRequest = (config) => async (req, res) => {
path.join(config.rootDir, parsedUrl.pathname)
);
// Handle root path or directory paths, serve index.html
if (filePath === path.normalize(config.rootDir) || filePath.endsWith("/")) {
filePath = path.join(filePath, "index.html");
// Handle root path, directory paths, or paths without file extensions by serving index.html
if (
filePath === path.normalize(config.rootDir) ||
filePath.endsWith("/") ||
!path.extname(filePath)
) {
filePath = path.join(config.rootDir, "index.html");
}
// Check if file exists and get its stats