Skip to content

Commit

Permalink
fix(sdk): cannot use relative paths for container images (#6518)
Browse files Browse the repository at this point in the history
The `isPath` utility didn't take into account `../` as an option. Meh!

## Checklist

- [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted)
- [x] Description explains motivation and solution
- [x] Tests added (always)
- [x] Docs updated (only required for features)
- [x] Added `pr/e2e-full` label if this feature requires end-to-end testing

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
  • Loading branch information
eladb authored May 18, 2024
1 parent 75206d8 commit 305def8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libs/wingsdk/src/shared/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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("/");
}
10 changes: 10 additions & 0 deletions libs/wingsdk/test/misc.test.ts
Original file line number Diff line number Diff line change
@@ -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();
});

0 comments on commit 305def8

Please sign in to comment.