mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 04:27:41 +00:00
fix(discord): handle multi-attachment inbound media
This commit is contained in:
@@ -2,6 +2,7 @@ import type { Guild } from "@buape/carbon";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
allowListMatches,
|
||||
buildDiscordMediaPayload,
|
||||
type DiscordGuildEntryResolved,
|
||||
isDiscordGroupAllowedByPolicy,
|
||||
normalizeDiscordAllowList,
|
||||
@@ -346,3 +347,26 @@ describe("discord reaction notification gating", () => {
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("discord media payload", () => {
|
||||
it("preserves attachment order for MediaPaths/MediaUrls", () => {
|
||||
const payload = buildDiscordMediaPayload([
|
||||
{ path: "/tmp/a.png", contentType: "image/png" },
|
||||
{ path: "/tmp/b.png", contentType: "image/png" },
|
||||
{ path: "/tmp/c.png", contentType: "image/png" },
|
||||
]);
|
||||
expect(payload.MediaPath).toBe("/tmp/a.png");
|
||||
expect(payload.MediaUrl).toBe("/tmp/a.png");
|
||||
expect(payload.MediaType).toBe("image/png");
|
||||
expect(payload.MediaPaths).toEqual([
|
||||
"/tmp/a.png",
|
||||
"/tmp/b.png",
|
||||
"/tmp/c.png",
|
||||
]);
|
||||
expect(payload.MediaUrls).toEqual([
|
||||
"/tmp/a.png",
|
||||
"/tmp/b.png",
|
||||
"/tmp/c.png",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user