mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-08 19:12:22 +00:00
fix(macos): validate DMG layout values
This commit is contained in:
@@ -265,6 +265,42 @@ describe.runIf(process.platform === "darwin")("create-dmg ownership boundaries",
|
||||
expect(readFileSync(tools.hdiutilLog, "utf8")).not.toContain("detach");
|
||||
});
|
||||
|
||||
it("fails before image creation when Finder layout values are malformed", () => {
|
||||
const app = makeValidApp();
|
||||
const outputDir = mkdtempSync(path.join(tmpdir(), "openclaw-create-dmg-output-"));
|
||||
tempDirs.push(outputDir);
|
||||
const output = path.join(outputDir, "OpenClaw.dmg");
|
||||
const tools = makeFakeDmgTools();
|
||||
|
||||
const result = runScript([app, output], {
|
||||
...tools.env,
|
||||
DMG_WINDOW_BOUNDS: "400 nope 900 420",
|
||||
});
|
||||
|
||||
expect(result.status).toBe(1);
|
||||
expect(result.stderr).toContain("DMG_WINDOW_BOUNDS must contain only integer values");
|
||||
expect(existsSync(output)).toBe(false);
|
||||
expect(existsSync(tools.hdiutilLog) ? readFileSync(tools.hdiutilLog, "utf8") : "").toBe("");
|
||||
});
|
||||
|
||||
it("fails before image creation when Finder layout values span multiple lines", () => {
|
||||
const app = makeValidApp();
|
||||
const outputDir = mkdtempSync(path.join(tmpdir(), "openclaw-create-dmg-output-"));
|
||||
tempDirs.push(outputDir);
|
||||
const output = path.join(outputDir, "OpenClaw.dmg");
|
||||
const tools = makeFakeDmgTools();
|
||||
|
||||
const result = runScript([app, output], {
|
||||
...tools.env,
|
||||
DMG_WINDOW_BOUNDS: "400 100 900 420\nnope",
|
||||
});
|
||||
|
||||
expect(result.status).toBe(1);
|
||||
expect(result.stderr).toContain("DMG_WINDOW_BOUNDS must be a single line");
|
||||
expect(existsSync(output)).toBe(false);
|
||||
expect(existsSync(tools.hdiutilLog) ? readFileSync(tools.hdiutilLog, "utf8") : "").toBe("");
|
||||
});
|
||||
|
||||
it("preserves an existing output when verification fails", () => {
|
||||
const app = makeValidApp();
|
||||
const outputDir = mkdtempSync(path.join(tmpdir(), "openclaw-create-dmg-output-"));
|
||||
|
||||
Reference in New Issue
Block a user