mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-13 13:10:34 +00:00
refactor(outbound): centralize attachment media policy
This commit is contained in:
@@ -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,
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user