diff --git a/libs/wingsdk/src/shared/misc.ts b/libs/wingsdk/src/shared/misc.ts index d87cfb5a332..be6e2975219 100644 --- a/libs/wingsdk/src/shared/misc.ts +++ b/libs/wingsdk/src/shared/misc.ts @@ -51,5 +51,5 @@ export async function shell( export function isPath(s: string) { s = normalPath(s); - return s.startsWith("./") || s.startsWith("/"); + return s.startsWith("./") || s.startsWith("../") || s.startsWith("/"); } diff --git a/libs/wingsdk/test/misc.test.ts b/libs/wingsdk/test/misc.test.ts new file mode 100644 index 00000000000..43ae07e8029 --- /dev/null +++ b/libs/wingsdk/test/misc.test.ts @@ -0,0 +1,10 @@ +import { expect, test } from "vitest"; +import { isPath } from "../src/shared/misc"; + +test("isPath", () => { + expect(isPath("foo")).toBeFalsy(); + expect(isPath("./hello")).toBeTruthy(); + expect(isPath("../hello")).toBeTruthy(); + expect(isPath(".././../hello")).toBeTruthy(); + expect(isPath("/hello/world")).toBeTruthy(); +});