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:
Omair Afzal 2026-02-24 08:22:39 +05:00 committed by GitHub
parent 7b2b86c60a
commit 177f167eab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -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 [];
}