From 1d2420331db0df32ae0c0a44ceb3d6571b3e92d6 Mon Sep 17 00:00:00 2001 From: joneugster Date: Tue, 28 Nov 2023 11:05:50 +0100 Subject: [PATCH] make URL case insensitive --- client/src/index.tsx | 5 +++++ server/index.mjs | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/client/src/index.tsx b/client/src/index.tsx index 9367f4c..c42b6dc 100644 --- a/client/src/index.tsx +++ b/client/src/index.tsx @@ -34,6 +34,11 @@ const router = createHashRouter([ path: "/game/nng", loader: () => redirect("/g/hhu-adam/NNG4") }, + { + // For backwards compatibility + path: "/g/hhu-adam/NNG4", + loader: () => redirect("/g/leanprover-community/NNG4") + }, { path: "/g/:owner/:repo", element: , diff --git a/server/index.mjs b/server/index.mjs index dd026d0..c3ea647 100644 --- a/server/index.mjs +++ b/server/index.mjs @@ -123,8 +123,8 @@ const urlRegEx = /^\/websocket\/g\/([\w.-]+)\/([\w.-]+)$/ wss.addListener("connection", function(ws, req) { const reRes = urlRegEx.exec(req.url) if (!reRes) { console.error(`Connection refused because of invalid URL: ${req.url}`); return; } - const owner = reRes[1] - const repo = reRes[2] + const owner = reRes[1].toLowerCase() + const repo = reRes[2].toLowerCase() let ps if (!queue[tag(owner, repo)] || queue[tag(owner, repo)].length == 0) {