fix(ci): stabilize Windows path handling in sandbox tests

This commit is contained in:
Peter Steinberger
2026-02-21 14:32:10 +01:00
parent 10b8839a82
commit 14b3743228
2 changed files with 9 additions and 0 deletions

View File

@@ -154,6 +154,10 @@ describe("msteams media-helpers", () => {
expect(isLocalPath("\\\\server\\share\\image.png")).toBe(true);
});
it("returns true for Windows rooted paths", () => {
expect(isLocalPath("\\tmp\\openclaw\\file.txt")).toBe(true);
});
it("returns false for http URLs", () => {
expect(isLocalPath("http://example.com/image.png")).toBe(false);
expect(isLocalPath("https://example.com/image.png")).toBe(false);

View File

@@ -69,6 +69,11 @@ export function isLocalPath(url: string): boolean {
return true;
}
// Windows rooted path on current drive (e.g. \tmp\file.txt)
if (url.startsWith("\\") && !url.startsWith("\\\\")) {
return true;
}
// Windows drive-letter absolute path (e.g. C:\foo\bar.txt or C:/foo/bar.txt)
if (/^[a-zA-Z]:[\\/]/.test(url)) {
return true;