From acd68817e9e6900049be81b68ad0d81be7e79de4 Mon Sep 17 00:00:00 2001 From: perf3ct Date: Wed, 18 Jun 2025 20:46:11 +0000 Subject: [PATCH] feat(server): fix lint type errors for normalizing server URLs --- apps/server/src/routes/custom.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/server/src/routes/custom.ts b/apps/server/src/routes/custom.ts index e667a371b..b27a710f2 100644 --- a/apps/server/src/routes/custom.ts +++ b/apps/server/src/routes/custom.ts @@ -40,21 +40,21 @@ function handleRequest(req: Request, res: Response) { // Get normalized patterns to handle both trailing slash cases const patterns = normalizeCustomHandlerPattern(attr.value); - let match = null; + let match: RegExpMatchArray | null = null; - // Try each pattern until we find a match - for (const pattern of patterns) { - try { + try { + // Try each pattern until we find a match + for (const pattern of patterns) { const regex = new RegExp(`^${pattern}$`); match = path.match(regex); if (match) { break; // Found a match, exit pattern loop } - } catch (e: unknown) { - const [errMessage, errStack] = safeExtractMessageAndStackFromError(e); - log.error(`Testing path for label '${attr.attributeId}', regex '${pattern}' failed with error: ${errMessage}, stack: ${errStack}`); - continue; } + } catch (e: unknown) { + const [errMessage, errStack] = safeExtractMessageAndStackFromError(e); + log.error(`Testing path for label '${attr.attributeId}', regex '${attr.value}' failed with error: ${errMessage}, stack: ${errStack}`); + continue; } if (!match) {