From 906910d1395cca7ecb9dbca27cbc8d6aef8ce191 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Mon, 19 Apr 2021 10:32:20 +0200 Subject: [PATCH] redirect github page requests that do not end with / --- routes/webview.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/routes/webview.js b/routes/webview.js index c36a90a..1299e4f 100644 --- a/routes/webview.js +++ b/routes/webview.js @@ -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;