aboutsummaryrefslogtreecommitdiff
path: root/lib/static.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/static.js')
-rw-r--r--lib/static.js9
1 files changed, 8 insertions, 1 deletions
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);