From e611126c7c168b7c14e6d79fe02e1f996937bbfc Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 17 Aug 2021 22:42:16 +0200 Subject: :art: clean up --- api/src/middlewares/Authentication.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'api/src/middlewares') diff --git a/api/src/middlewares/Authentication.ts b/api/src/middlewares/Authentication.ts index 06eeab39..a8bfe196 100644 --- a/api/src/middlewares/Authentication.ts +++ b/api/src/middlewares/Authentication.ts @@ -27,11 +27,12 @@ declare global { export async function Authentication(req: Request, res: Response, next: NextFunction) { if (req.method === "OPTIONS") return res.sendStatus(204); - if (req.url.startsWith("/invites") && req.method === "GET") return next(); // @ts-ignore + const url = req.url.replace(API_PREFIX, ""); + if (url.startsWith("/invites") && req.method === "GET") return next(); // @ts-ignore if ( NO_AUTHORIZATION_ROUTES.some((x) => { - if (typeof x === "string") return req.url.startsWith(x); - return x.test(req.url); + if (typeof x === "string") return url.startsWith(x); + return x.test(url); }) ) return next(); -- cgit 1.5.1