mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
feat(server): fix lint type errors for normalizing server URLs
This commit is contained in:
parent
bb70c2a3fa
commit
acd68817e9
@ -40,21 +40,21 @@ function handleRequest(req: Request, res: Response) {
|
|||||||
|
|
||||||
// Get normalized patterns to handle both trailing slash cases
|
// Get normalized patterns to handle both trailing slash cases
|
||||||
const patterns = normalizeCustomHandlerPattern(attr.value);
|
const patterns = normalizeCustomHandlerPattern(attr.value);
|
||||||
let match = null;
|
let match: RegExpMatchArray | null = null;
|
||||||
|
|
||||||
// Try each pattern until we find a match
|
try {
|
||||||
for (const pattern of patterns) {
|
// Try each pattern until we find a match
|
||||||
try {
|
for (const pattern of patterns) {
|
||||||
const regex = new RegExp(`^${pattern}$`);
|
const regex = new RegExp(`^${pattern}$`);
|
||||||
match = path.match(regex);
|
match = path.match(regex);
|
||||||
if (match) {
|
if (match) {
|
||||||
break; // Found a match, exit pattern loop
|
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) {
|
if (!match) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user