redirect github page requests that do not end with /

This commit is contained in:
tdurieux
2021-04-19 10:32:20 +02:00
parent 640665b74e
commit 906910d139

View File

@@ -25,7 +25,6 @@ async function webView(req, res) {
let requestPath = req.path.substring(
req.path.indexOf(repoId) + repoId.length
);
if (requestPath[requestPath.length - 1] == "/") {
requestPath = path.join(requestPath, "index.html");
}
@@ -66,5 +65,8 @@ async function webView(req, res) {
}
router.get("/:repoId/*", webView);
router.get("/:repoId", (req, res) => {
res.redirect("/w/" + req.url + "/")
});
module.exports = router;