mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:00:43 +00:00
fix(codex): normalize compacted Windows permission paths
This commit is contained in:
@@ -641,7 +641,7 @@ describe("Codex app-server approval bridge", () => {
|
||||
|
||||
const [, , requestPayload] = mockCallGatewayTool.mock.calls[0] ?? [];
|
||||
const description = (requestPayload as { description: string }).description;
|
||||
expect(description).toContain("File system roots: ~; readPaths: ~\\.ssh\\id_rsa, ~/project");
|
||||
expect(description).toContain("File system roots: ~; readPaths: ~/.ssh/id_rsa, ~/project");
|
||||
expect(description).not.toContain("High-risk targets");
|
||||
});
|
||||
|
||||
|
||||
@@ -436,7 +436,10 @@ function sanitizePermissionPathValue(value: string): string {
|
||||
.replace(/^\/home\/(?!\.{1,2}(?=\/|$))[^/]+(?=\/|$)/, "~")
|
||||
.replace(/^\/Users\/(?!\.{1,2}(?=\/|$))[^/]+(?=\/|$)/, "~")
|
||||
.replace(/^[A-Za-z]:[\\/]Users[\\/](?!\.{1,2}(?=[\\/]|$))[^\\/]+(?=[\\/]|$)/i, "~");
|
||||
return truncate(homeCompacted, PERMISSION_VALUE_MAX_LENGTH);
|
||||
const displayPath = homeCompacted.startsWith("~")
|
||||
? homeCompacted.replace(/\\/g, "/")
|
||||
: homeCompacted;
|
||||
return truncate(displayPath, PERMISSION_VALUE_MAX_LENGTH);
|
||||
}
|
||||
|
||||
function sanitizePermissionScalar(value: string): string {
|
||||
|
||||
Reference in New Issue
Block a user