test(media): harden media store URI validation · openclaw/openclaw@6639b21
steipete
·
2026-04-23
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -450,4 +450,22 @@ describe("loadWebMedia", () => {
|
450 | 450 | await fs.rm(filePath, { force: true }); |
451 | 451 | } |
452 | 452 | }); |
| 453 | + |
| 454 | +it("rejects unsupported media store URI locations", async () => { |
| 455 | +await expect(loadWebMedia("media://outbound/tiny.png")).rejects.toMatchObject({ |
| 456 | +code: "path-not-allowed", |
| 457 | +}); |
| 458 | +}); |
| 459 | + |
| 460 | +it("rejects media store URI ids with encoded path separators", async () => { |
| 461 | +await expect(loadWebMedia("media://inbound/nested%2Ftiny.png")).rejects.toMatchObject({ |
| 462 | +code: "invalid-path", |
| 463 | +}); |
| 464 | +}); |
| 465 | + |
| 466 | +it("rejects media store URIs without an id", async () => { |
| 467 | +await expect(loadWebMedia("media://inbound/")).rejects.toMatchObject({ |
| 468 | +code: "invalid-path", |
| 469 | +}); |
| 470 | +}); |
453 | 471 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。