From c3351dd3941d669f0889d3944f8bc4fe116a4b27 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 44f24bca3a..e36261b314 100644 --- a/src/lib/app.ts +++ b/src/lib/app.ts @@ -62,6 +62,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);