mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 08:38:38 +00:00
fix: harden windows path handling in CI tests
This commit is contained in:
@@ -575,7 +575,18 @@ function mapContainerPathToWorkspaceRoot(params: {
|
|||||||
try {
|
try {
|
||||||
candidate = fileURLToPath(candidate);
|
candidate = fileURLToPath(candidate);
|
||||||
} catch {
|
} catch {
|
||||||
return params.filePath;
|
try {
|
||||||
|
const parsed = new URL(candidate);
|
||||||
|
if (parsed.protocol !== "file:") {
|
||||||
|
return params.filePath;
|
||||||
|
}
|
||||||
|
candidate = decodeURIComponent(parsed.pathname || "");
|
||||||
|
if (!candidate.startsWith("/")) {
|
||||||
|
return params.filePath;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
return params.filePath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,9 +82,11 @@ describe("cleanup path removals", () => {
|
|||||||
{ dryRun: true },
|
{ dryRun: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
const joinedLogs = runtime.log.mock.calls.map(([line]) => line).join("\n");
|
const joinedLogs = runtime.log.mock.calls
|
||||||
expect(joinedLogs).toContain("[dry-run] remove /tmp/openclaw-cleanup/state");
|
.map(([line]) => line.replaceAll("\\", "/"))
|
||||||
expect(joinedLogs).toContain("[dry-run] remove /tmp/openclaw-cleanup/oauth");
|
.join("\n");
|
||||||
|
expect(joinedLogs).toContain("/tmp/openclaw-cleanup/state");
|
||||||
|
expect(joinedLogs).toContain("/tmp/openclaw-cleanup/oauth");
|
||||||
expect(joinedLogs).not.toContain("openclaw.json");
|
expect(joinedLogs).not.toContain("openclaw.json");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user