Skip to content

Commit c28d69c

Browse files
committed
test(qqbot): use distinct download paths per image; note voice sentinel in comment
1 parent 4234534 commit c28d69c

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎extensions/qqbot/src/engine/gateway/inbound-attachments.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ describe("engine/gateway/inbound-attachments", () => {
7474
});
7575

7676
it("classifies image content types case-insensitively when download succeeds", async () => {
77-
downloadFileMock.mockResolvedValue("/tmp/openclaw-qqbot-downloads/a.png");
77+
downloadFileMock.mockResolvedValueOnce("/tmp/openclaw-qqbot-downloads/a.png");
78+
downloadFileMock.mockResolvedValueOnce("/tmp/openclaw-qqbot-downloads/b.png");
7879

7980
const result = await processAttachments(
8081
[
@@ -86,7 +87,7 @@ describe("engine/gateway/inbound-attachments", () => {
8687

8788
expect(result.imageUrls).toEqual([
8889
"/tmp/openclaw-qqbot-downloads/a.png",
89-
"/tmp/openclaw-qqbot-downloads/a.png",
90+
"/tmp/openclaw-qqbot-downloads/b.png",
9091
]);
9192
// The raw content_type passes through unchanged.
9293
expect(result.imageMediaTypes).toEqual(["image/png", "Image/PNG"]);

‎extensions/qqbot/src/engine/utils/audio.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,9 @@ export async function convertSilkToWav(
118118

119119
/** Check whether an attachment is a voice file (by MIME type or extension). */
120120
export function isVoiceAttachment(att: { content_type?: string; filename?: string }): boolean {
121-
// MIME types are case-insensitive (RFC 2045) and relays may emit
122-
// mixed-case values; compare lowercased like the extension check below.
121+
// MIME types are case-insensitive (RFC 2045) and relays may emit mixed-case
122+
// values; the bare "voice" platform sentinel gets the same treatment.
123+
// Compare lowercased like the extension check below.
123124
const contentType = normalizeLowercase(att.content_type);
124125
if (contentType === "voice" || contentType.startsWith("audio/")) {
125126
return true;

0 commit comments

Comments
 (0)