From 84c619d95717b40f5180c18d09a13871b43648be Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sat, 7 Mar 2026 09:19:41 -0800 Subject: [PATCH] Web: cover wildcard local media roots --- src/web/media.test.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/web/media.test.ts b/src/web/media.test.ts index 9db06e3024a..2218c0211ee 100644 --- a/src/web/media.test.ts +++ b/src/web/media.test.ts @@ -502,4 +502,30 @@ describe("local media root guard", () => { }), ); }); + + it("allows wildcard-style local roots for iMessage attachment paths", async () => { + const attachmentRoot = path.join(os.tmpdir(), "openclaw-imessage-root"); + const attachmentFile = path.join( + attachmentRoot, + "alice", + "Library", + "Messages", + "Attachments", + "x.bin", + ); + const readFile = vi.fn(async () => Buffer.from("generated-media")); + const wildcardRoot = path.join(attachmentRoot, "*", "Library", "Messages", "Attachments"); + + await expect( + loadWebMedia(attachmentFile, { + maxBytes: 1024 * 1024, + localRoots: [wildcardRoot], + readFile, + }), + ).resolves.toEqual( + expect.objectContaining({ + kind: "unknown", + }), + ); + }); });