fix: guard .trim() calls on potentially undefined workspaceDir (#24875)
Change workspaceDir param type from string to string | undefined in resolvePluginSkillDirs and use nullish coalescing before .trim() to prevent TypeError when workspaceDir is undefined.
This commit is contained in:
@@ -12,10 +12,10 @@ import { loadPluginManifestRegistry } from "../../plugins/manifest-registry.js";
|
||||
const log = createSubsystemLogger("skills");
|
||||
|
||||
export function resolvePluginSkillDirs(params: {
|
||||
workspaceDir: string;
|
||||
workspaceDir: string | undefined;
|
||||
config?: OpenClawConfig;
|
||||
}): string[] {
|
||||
const workspaceDir = params.workspaceDir.trim();
|
||||
const workspaceDir = (params.workspaceDir ?? "").trim();
|
||||
if (!workspaceDir) {
|
||||
return [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user