From 3193dcdce7a55ba8fc7fd2ab5007938fc3f09778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivar=20Conradi=20=C3=98sthus?= Date: Tue, 6 Jun 2023 12:21:23 +0200 Subject: [PATCH] fix: remove consecutive slashes A small middleware who will rewrite potential dual slashes to a single slash. --- src/lib/app.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/app.ts b/src/lib/app.ts index 68b5d3b718..819adf9a23 100644 --- a/src/lib/app.ts +++ b/src/lib/app.ts @@ -55,6 +55,10 @@ export default async function getApp( app.use(compression()); app.use(cookieParser()); + app.use((req, res, next) => { + req.url = req.url.replace(/\/+/g, '/'); + next(); + }); app.use(express.json({ strict: false })); if (unleashSession) { app.use(unleashSession);