fix: replace stale plugin webhook routes on re-registration

This commit is contained in:
Peter Steinberger
2026-02-24 04:01:41 +00:00
parent d76742ff88
commit 588a188d6f
2 changed files with 82 additions and 3 deletions

View File

@@ -29,10 +29,11 @@ export function registerPluginHttpRoute(params: {
return () => {};
}
if (routes.some((entry) => entry.path === normalizedPath)) {
const existingIndex = routes.findIndex((entry) => entry.path === normalizedPath);
if (existingIndex >= 0) {
const pluginHint = params.pluginId ? ` (${params.pluginId})` : "";
params.log?.(`plugin: webhook path ${normalizedPath} already registered${suffix}${pluginHint}`);
return () => {};
params.log?.(`plugin: replacing stale webhook path ${normalizedPath}${suffix}${pluginHint}`);
routes.splice(existingIndex, 1);
}
const entry: PluginHttpRouteRegistration = {