refactor(outbound): centralize attachment media policy

This commit is contained in:
Peter Steinberger
2026-02-24 23:28:46 +00:00
parent 54648a9cf1
commit 5c2a483375
3 changed files with 84 additions and 26 deletions

View File

@@ -512,6 +512,15 @@ describe("runMessageAction sendAttachment hydration", () => {
expect((result.payload as { buffer?: string }).buffer).toBe(
Buffer.from("hello").toString("base64"),
);
const call = vi.mocked(loadWebMedia).mock.calls[0];
expect(call?.[1]).toEqual(
expect.objectContaining({
localRoots: expect.any(Array),
}),
);
expect((call?.[1] as { sandboxValidated?: boolean } | undefined)?.sandboxValidated).not.toBe(
true,
);
});
it("rewrites sandboxed media paths for sendAttachment", async () => {
@@ -530,6 +539,11 @@ describe("runMessageAction sendAttachment hydration", () => {
const call = vi.mocked(loadWebMedia).mock.calls[0];
expect(call?.[0]).toBe(path.join(sandboxDir, "data", "pic.png"));
expect(call?.[1]).toEqual(
expect.objectContaining({
sandboxValidated: true,
}),
);
});
});