惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
IT之家
IT之家
博客园_首页
博客园 - 【当耐特】
V
V2EX
Apple Machine Learning Research
Apple Machine Learning Research
G
Google Developers Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Recent Announcements
Recent Announcements
F
Fortinet All Blogs
GbyAI
GbyAI
腾讯CDC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
I
InfoQ
H
Help Net Security
T
Tailwind CSS Blog
B
Blog RSS Feed
Martin Fowler
Martin Fowler
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
博客园 - 叶小钗
雷峰网
雷峰网
量子位

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(whatsapp): honor forceDocument flag end-to-end (#7927...
itsuzef · 2026-05-17 · via Recent Commits to openclaw:main

@@ -107,6 +107,7 @@ describe("web outbound", () => {

107107

};

108108

mediaLocalRoots?: readonly string[];

109109

mediaReadFile?: (filePath: string) => Promise<Buffer>;

110+

optimizeImages?: boolean;

110111

},

111112

) =>

112113

await loadWebMediaMock(mediaUrl, {

@@ -451,6 +452,89 @@ describe("web outbound", () => {

451452

});

452453

});

453454455+

it("forces document branch when forceDocument is true with image media", async () => {

456+

const buf = Buffer.from("img");

457+

loadWebMediaMock.mockResolvedValueOnce({

458+

buffer: buf,

459+

contentType: "image/jpeg",

460+

kind: "image",

461+

fileName: "promo.jpg",

462+

});

463+

await sendMessageWhatsApp("+1555", "look", {

464+

verbose: false,

465+

cfg: WHATSAPP_TEST_CFG,

466+

mediaUrl: "/tmp/pic.jpg",

467+

forceDocument: true,

468+

});

469+

expect(sendMessage).toHaveBeenLastCalledWith("+1555", "look", buf, "image/jpeg", {

470+

asDocument: true,

471+

fileName: "promo.jpg",

472+

});

473+

expect(hoisted.loadOutboundMediaFromUrl).toHaveBeenCalledWith(

474+

"/tmp/pic.jpg",

475+

expect.objectContaining({ optimizeImages: false }),

476+

);

477+

});

478+479+

it("forces document branch when forceDocument is true with video media", async () => {

480+

const buf = Buffer.from("video");

481+

loadWebMediaMock.mockResolvedValueOnce({

482+

buffer: buf,

483+

contentType: "video/mp4",

484+

kind: "video",

485+

fileName: "clip.mp4",

486+

});

487+

await sendMessageWhatsApp("+1555", "watch", {

488+

verbose: false,

489+

cfg: WHATSAPP_TEST_CFG,

490+

mediaUrl: "/tmp/clip.mp4",

491+

forceDocument: true,

492+

});

493+

expect(sendMessage).toHaveBeenLastCalledWith("+1555", "watch", buf, "video/mp4", {

494+

asDocument: true,

495+

fileName: "clip.mp4",

496+

});

497+

});

498+499+

it("falls back to a default filename when forceDocument media has no fileName", async () => {

500+

const buf = Buffer.from("img");

501+

loadWebMediaMock.mockResolvedValueOnce({

502+

buffer: buf,

503+

contentType: "image/png",

504+

kind: "image",

505+

});

506+

await sendMessageWhatsApp("+1555", "promo", {

507+

verbose: false,

508+

cfg: WHATSAPP_TEST_CFG,

509+

mediaUrl: "/tmp/pic.png",

510+

forceDocument: true,

511+

});

512+

expect(sendMessage).toHaveBeenLastCalledWith("+1555", "promo", buf, "image/png", {

513+

asDocument: true,

514+

fileName: "file",

515+

});

516+

});

517+518+

it("keeps audio on the voice-note path when forceDocument is true", async () => {

519+

const buf = Buffer.from("audio");

520+

loadWebMediaMock.mockResolvedValueOnce({

521+

buffer: buf,

522+

contentType: "audio/ogg",

523+

kind: "audio",

524+

fileName: "voice.ogg",

525+

});

526+527+

await sendMessageWhatsApp("+1555", "voice note", {

528+

verbose: false,

529+

cfg: WHATSAPP_TEST_CFG,

530+

mediaUrl: "/tmp/voice.ogg",

531+

forceDocument: true,

532+

});

533+534+

expect(sendMessage).toHaveBeenNthCalledWith(1, "+1555", "", buf, "audio/ogg; codecs=opus");

535+

expect(sendMessage).toHaveBeenNthCalledWith(2, "+1555", "voice note", undefined, undefined);

536+

});

537+454538

it("uses account-aware WhatsApp media caps for outbound uploads", async () => {

455539

hoisted.controllerListeners.set("work", {

456540

sendComposingTo,