mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-05-20 00:14:43 +02:00
redirect github page requests that do not end with /
This commit is contained in:
+3
-1
@@ -25,7 +25,6 @@ async function webView(req, res) {
|
|||||||
let requestPath = req.path.substring(
|
let requestPath = req.path.substring(
|
||||||
req.path.indexOf(repoId) + repoId.length
|
req.path.indexOf(repoId) + repoId.length
|
||||||
);
|
);
|
||||||
|
|
||||||
if (requestPath[requestPath.length - 1] == "/") {
|
if (requestPath[requestPath.length - 1] == "/") {
|
||||||
requestPath = path.join(requestPath, "index.html");
|
requestPath = path.join(requestPath, "index.html");
|
||||||
}
|
}
|
||||||
@@ -66,5 +65,8 @@ async function webView(req, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
router.get("/:repoId/*", webView);
|
router.get("/:repoId/*", webView);
|
||||||
|
router.get("/:repoId", (req, res) => {
|
||||||
|
res.redirect("/w/" + req.url + "/")
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
Reference in New Issue
Block a user