diff options
author | Alexis Hovorka <[email protected]> | 2020-11-04 15:50:15 -0700 |
---|---|---|
committer | Alexis Hovorka <[email protected]> | 2020-11-04 15:50:15 -0700 |
commit | 74f7f2d1a59286f213866609de69c0ffd75eb833 (patch) | |
tree | 2e90931b4ffab24d1ff42accb25cca5b4ccb5e62 /lib/static.js | |
parent | d5af5379ce3bcb7d9e158c52b430faa945e39694 (diff) |
Diffstat (limited to 'lib/static.js')
-rw-r--r-- | lib/static.js | 9 |
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); |