diff --git a/src/hooks/workspace.ts b/src/hooks/workspace.ts index 7b86d9d23c8..32bb903f909 100644 --- a/src/hooks/workspace.ts +++ b/src/hooks/workspace.ts @@ -81,11 +81,19 @@ function loadHookFromDir(params: { nameHint?: string; }): Hook | null { const hookMdPath = path.join(params.hookDir, "HOOK.md"); - const content = readBoundaryFileUtf8({ + const safeHookMdPath = resolveBoundaryFilePath({ absolutePath: hookMdPath, rootPath: params.hookDir, boundaryLabel: "hook directory", }); + if (!safeHookMdPath) { + return null; + } + const content = readBoundaryFileUtf8({ + absolutePath: safeHookMdPath, + rootPath: params.hookDir, + boundaryLabel: "hook directory", + }); if (content === null) { return null; } @@ -127,7 +135,7 @@ function loadHookFromDir(params: { description, source: params.source, pluginId: params.pluginId, - filePath: hookMdPath, + filePath: safeHookMdPath, baseDir, handlerPath, };