From 7a9ea0449e8ee24a5bbcbcf85ed6cf0aab351f90 Mon Sep 17 00:00:00 2001 From: Regalijan Date: Thu, 22 Feb 2024 13:13:51 -0500 Subject: [PATCH] Fix path segment check --- functions/api/events-team/events/[id]/_middleware.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/api/events-team/events/[id]/_middleware.ts b/functions/api/events-team/events/[id]/_middleware.ts index 7ee2be6..c2ff1a3 100644 --- a/functions/api/events-team/events/[id]/_middleware.ts +++ b/functions/api/events-team/events/[id]/_middleware.ts @@ -4,7 +4,7 @@ export async function onRequest(context: RequestContext) { const pathSegments = new URL(context.request.url).pathname.split("/"); // Skip checks for the by-id endpoint - if (pathSegments.length > 5) return await context.next(); + if (pathSegments.length <= 5) return await context.next(); const eventInfo = await context.env.D1.prepare( "SELECT * FROM events WHERE id = ?;",