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

@@ -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;