From 74f7f2d1a59286f213866609de69c0ffd75eb833 Mon Sep 17 00:00:00 2001 From: Alexis Hovorka Date: Wed, 4 Nov 2020 15:50:15 -0700 Subject: [chore] Saving misc modifications 2020-11-04 --- lib/static.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/static.js b/lib/static.js index 2be10bc..7c2f9c1 100644 --- a/lib/static.js +++ b/lib/static.js @@ -56,7 +56,14 @@ module.exports = class Static { return res.end(this.e500); }} - if (stats.isDirectory()) path += "/index.html"; + if (stats.isDirectory()) { + if (!path.endsWith("/")) { + res.writeHead(302, {"Location":sane+"/"}); + return res.end(`Redirecting: ${sane}/`); + } + path += "index.html"; + } + const ext = `${Path.extname(path)}`.toLowerCase(); const stream = fs.createReadStream(path); -- cgit v1.2.3-54-g00ecf