fix(utils): guard resolveUserPath for missing workspace input
This commit is contained in:
@@ -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("");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user