fix(utils): guard resolveUserPath for missing workspace input

This commit is contained in:
Peter Steinberger
2026-02-22 13:19:12 +01:00
parent 0d0f4c6992
commit eec3182cbb
3 changed files with 9 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ Docs: https://docs.openclaw.ai
### Fixes
- Agents/Workspace: guard `resolveUserPath` against undefined/null input to prevent `Cannot read properties of undefined (reading 'trim')` crashes when workspace paths are missing in embedded runner flows.
- Auth/Profiles: keep active `cooldownUntil`/`disabledUntil` windows immutable across retries so mid-window failures cannot extend recovery indefinitely; only recompute a backoff window after the previous deadline has expired. This resolves cron/inbound retry loops that could trap gateways until manual `usageStats` cleanup. (#23516, #23536) Thanks @arosstale.
- Channels/Security: fail closed on missing provider group policy config by defaulting runtime group policy to `allowlist` (instead of inheriting `channels.defaults.groupPolicy`) when `channels.<provider>` is absent across message channels, and align runtime + security warnings/docs to the same fallback behavior (Slack, Discord, iMessage, Telegram, WhatsApp, Signal, LINE, Matrix, Mattermost, Google Chat, IRC, Nextcloud Talk, Feishu, and Zalo user flows; plus Discord message/native-command paths). (#23367) Thanks @bmendonca3.
- Gateway/Onboarding: harden remote gateway onboarding defaults and guidance by defaulting discovered direct URLs to `wss://`, rejecting insecure non-loopback `ws://` targets in onboarding validation, and expanding remote-security remediation messaging across gateway client/call/doctor flows. (#23476) Thanks @bmendonca3.

View File

@@ -240,4 +240,9 @@ describe("resolveUserPath", () => {
expect(resolveUserPath("")).toBe("");
expect(resolveUserPath(" ")).toBe("");
});
it("returns empty string for undefined/null input", () => {
expect(resolveUserPath(undefined as unknown as string)).toBe("");
expect(resolveUserPath(null as unknown as string)).toBe("");
});
});

View File

@@ -283,6 +283,9 @@ export function truncateUtf16Safe(input: string, maxLen: number): string {
}
export function resolveUserPath(input: string): string {
if (!input) {
return "";
}
const trimmed = input.trim();
if (!trimmed) {
return trimmed;