feat(server): fix lint type errors for normalizing server URLs

This commit is contained in:
perf3ct 2025-06-18 20:46:11 +00:00
parent bb70c2a3fa
commit acd68817e9
No known key found for this signature in database
GPG Key ID: 569C4EEC436F5232

View File

@ -40,22 +40,22 @@ 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 {
// Try each pattern until we find a match
for (const pattern of patterns) {
try {
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}`);
log.error(`Testing path for label '${attr.attributeId}', regex '${attr.value}' failed with error: ${errMessage}, stack: ${errStack}`);
continue;
}
}
if (!match) {
continue;