mirror of
https://github.com/morluto/rea
synced 2026-10-25 22:08:11 -04:00
f85a932d71
rea-agents 6.5.0 passed an absolute caller path to Windows native
snapshot admission verbatim, so a spelling with forward slashes or
repeated separators reached the native component walker, which rejects
empty components as "Ambiguous Windows path component is unsupported"
(Win32 50). Current main already resolves every Windows caller path with
win32.resolve (fc791bb60), which collapses those spellings.
Pin that boundary: absoluteCallerPath normalizes four separator spellings
of one absolute Windows path, and on Windows parseBinaryTarget returns the
same canonical sourcePath for each of them. The Windows test fails when
the 6.5.0 verbatim-absolute-path rule is restored.
Fixes #4707
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
import { writeFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
|
|
import { expect, it } from "vitest";
|
|
|
|
import { parseBinaryTarget } from "../../../src/application/BinaryTargetResolver.js";
|
|
import { pe } from "../../../src/domain/binaryTarget.fixture.js";
|
|
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
|
|
|
// Windows native snapshot admission rejects empty and forward-slash path
|
|
// components, so the caller path it receives must already be one canonical
|
|
// drive path whatever separator spelling the caller used (#4707).
|
|
it.runIf(process.platform === "win32")(
|
|
"hands native admission one drive path for every separator spelling",
|
|
async () => {
|
|
const directory = await createTestTempDirectory("rea-win-separators-");
|
|
const path = join(directory, "image.exe");
|
|
await writeFile(path, pe(0x8664));
|
|
const spellings = [
|
|
path,
|
|
path.replaceAll("\\", "/"),
|
|
path.replaceAll("\\", "\\\\"),
|
|
path.replaceAll("\\", "//"),
|
|
];
|
|
for (const spelling of spellings) {
|
|
const target = await parseBinaryTarget(spelling);
|
|
expect(target.ok, spelling).toBe(true);
|
|
if (target.ok) expect(target.value.sourcePath, spelling).toBe(path);
|
|
}
|
|
},
|
|
);
|