




















@@ -49,18 +49,24 @@ describe("createSandboxBridgeReadFile", () => {
4949relativePath: filePath,
5050containerPath: `/sandbox/${filePath}`,
5151}));
52+const stat = vi.fn(async () => ({ type: "file", size: 1, mtimeMs: 1 }));
52535354const resolved = await resolveSandboxedBridgeMediaPath({
5455sandbox: {
5556root: "/tmp/sandbox-root",
5657bridge: {
5758 resolvePath,
59+ stat,
5860} as unknown as SandboxFsBridge,
5961},
6062mediaPath: "media://inbound/photo.png",
6163inboundFallbackDir: "media/inbound",
6264});
636566+expect(stat).toHaveBeenCalledWith({
67+filePath: "media/inbound/photo.png",
68+cwd: "/tmp/sandbox-root",
69+});
6470expect(resolvePath).toHaveBeenCalledWith({
6571filePath: "media/inbound/photo.png",
6672cwd: "/tmp/sandbox-root",
@@ -70,4 +76,22 @@ describe("createSandboxBridgeReadFile", () => {
7076rewrittenFrom: "media://inbound/photo.png",
7177});
7278});
79+80+it("rejects missing staged inbound media URIs before direct sandbox resolution", async () => {
81+const resolvePath = vi.fn();
82+await expect(
83+resolveSandboxedBridgeMediaPath({
84+sandbox: {
85+root: "/tmp/sandbox-root",
86+bridge: {
87+ resolvePath,
88+stat: vi.fn(async () => null),
89+} as unknown as SandboxFsBridge,
90+},
91+mediaPath: "media://inbound/missing.png",
92+inboundFallbackDir: "media/inbound",
93+}),
94+).rejects.toThrow("Sandbox media reference is not staged: media://inbound/missing.png");
95+expect(resolvePath).not.toHaveBeenCalled();
96+});
7397});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。