aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexis Hovorka <[email protected]>2020-11-04 15:50:15 -0700
committerAlexis Hovorka <[email protected]>2020-11-04 15:50:15 -0700
commit74f7f2d1a59286f213866609de69c0ffd75eb833 (patch)
tree2e90931b4ffab24d1ff42accb25cca5b4ccb5e62 /lib
parentd5af5379ce3bcb7d9e158c52b430faa945e39694 (diff)
[chore] Saving misc modifications 2020-11-04HEADmain
Diffstat (limited to 'lib')
-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);