fix(media): allow buffer-verified ZIP archives in host-read validator · openclaw/openclaw@d688196
Linux2010
·
2026-05-10
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -123,6 +123,7 @@ Docs: https://docs.openclaw.ai
|
123 | 123 | - Plugin skills/Windows: publish plugin-provided skill directories as junctions on Windows so standard users without Developer Mode can register plugin skills without symlink EPERM failures. Fixes #77958. (#77971) Thanks @hclsys and @jarro. |
124 | 124 | - Shell env/Windows: hide the login-shell environment probe child window so gateway startup and shell-env refreshes do not flash a console on Windows. Fixes #78159. (#78266) Thanks @BradGroux. |
125 | 125 | - MS Teams: surface blocked Bot Framework egress by logging JWKS fetch network failures and adding a Bot Connector send hint for transport-level reply failures. Fixes #77674. (#78081) Thanks @Beandon13. |
| 126 | +- Media/host-read: allow buffer-verified ZIP archives in the host-local media validator so agents can send ZIP attachments via the message tool. Fixes #78057. (#78292) Thanks @Linux2010. |
126 | 127 | - Gateway/sessions: fast-path already-qualified model refs while building session-list rows so `openclaw sessions` and Control UI session lists avoid heavyweight model resolution on large stores. (#77902) Thanks @ragesaq. |
127 | 128 | - Contributor PRs: remind external contributors to redact private information like IP addresses, API keys, phone numbers, and non-public endpoints from real behavior proof. Thanks @pashpashpash. |
128 | 129 | - ACP bridge: relay Gateway exec approval prompts from active ACP turns to the ACP client's `session/request_permission` handler before resolving the Gateway approval. Thanks @amknight. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -376,6 +376,21 @@ describe("loadWebMedia", () => {
|
376 | 376 | expect(result.contentType).toBe("text/markdown"); |
377 | 377 | }); |
378 | 378 | |
| 379 | +it("allows host-read ZIP files", async () => { |
| 380 | +const zipFile = path.join(fixtureRoot, "archive.zip"); |
| 381 | +// Write valid ZIP magic bytes (PK\x03\x04) with minimal empty ZIP structure. |
| 382 | +// file-type detects application/zip from these magic bytes. |
| 383 | +await fs.writeFile(zipFile, Buffer.from([0x50, 0x4b, 0x03, 0x04])); |
| 384 | +const result = await loadWebMedia(zipFile, { |
| 385 | +maxBytes: 1024 * 1024, |
| 386 | +localRoots: "any", |
| 387 | +readFile: async (filePath) => await fs.readFile(filePath), |
| 388 | +hostReadCapability: true, |
| 389 | +}); |
| 390 | +expect(result.kind).toBe("document"); |
| 391 | +expect(result.contentType).toBe("application/zip"); |
| 392 | +}); |
| 393 | + |
379 | 394 | it("rejects binary data disguised as a CSV file", async () => { |
380 | 395 | const fakeCsv = path.join(fixtureRoot, "evil.csv"); |
381 | 396 | // Write ZIP magic bytes — file-type detects application/zip (not image, not CSV), |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -123,6 +123,7 @@ const HOST_READ_ALLOWED_DOCUMENT_MIMES = new Set([
|
123 | 123 | "application/vnd.openxmlformats-officedocument.presentationml.presentation", |
124 | 124 | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", |
125 | 125 | "application/vnd.openxmlformats-officedocument.wordprocessingml.document", |
| 126 | +"application/zip", |
126 | 127 | "text/csv", |
127 | 128 | "text/markdown", |
128 | 129 | ]); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。