From 8934da785b7acd04536d249ff8df40ac8aa4dede Mon Sep 17 00:00:00 2001 From: Alberto Leal Date: Mon, 16 Feb 2026 03:37:28 -0500 Subject: [PATCH] test(media): verify tmpdir media paths allowed through message action runner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add integration test confirming that runMessageAction with a sandbox root now accepts media paths under os.tmpdir() through the full normalization pipeline (normalizeSandboxMediaList → resolveSandboxedMediaSource). --- .../outbound/message-action-runner.test.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/infra/outbound/message-action-runner.test.ts b/src/infra/outbound/message-action-runner.test.ts index cc50c9098..f2e6426d2 100644 --- a/src/infra/outbound/message-action-runner.test.ts +++ b/src/infra/outbound/message-action-runner.test.ts @@ -605,6 +605,30 @@ describe("runMessageAction sandboxed media validation", () => { expect(result.sendResult?.mediaUrl).toBe(path.join(sandboxDir, "data", "note.ogg")); }); }); + + it("allows media paths under os.tmpdir()", async () => { + const sandboxDir = await fs.mkdtemp(path.join(os.tmpdir(), "msg-sandbox-")); + try { + const tmpFile = path.join(os.tmpdir(), "test-media-image.png"); + const result = await runMessageAction({ + cfg: slackConfig, + action: "send", + params: { + channel: "slack", + target: "#C12345678", + media: tmpFile, + message: "", + }, + sandboxRoot: sandboxDir, + dryRun: true, + }); + + expect(result.kind).toBe("send"); + expect(result.sendResult?.mediaUrl).toBe(tmpFile); + } finally { + await fs.rm(sandboxDir, { recursive: true, force: true }); + } + }); }); describe("runMessageAction media caption behavior", () => {