Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

test(media): 兼容 Windows 图片路径越界测试的链接夹具

DavidShenaf8975dbb717
diff --git a/apps/desktop/src/main/cindy-media/__tests__/taskImageDelivery.test.ts b/apps/desktop/src/main/cindy-media/__tests__/taskImageDelivery.test.ts
index 786783c482..22dae78c1c 100644
--- a/apps/desktop/src/main/cindy-media/__tests__/taskImageDelivery.test.ts
+++ b/apps/desktop/src/main/cindy-media/__tests__/taskImageDelivery.test.ts
@@ -433,7 +433,13 @@ describe('task image delivery', () => {
if (kind === 'symlink') {
const outside = path.join(state.root, 'private.png');
await fs.writeFile(outside, PNG);
- await fs.symlink(outside, source);
+ if (process.platform === 'win32') {
+ // Junctions preserve the real path escape without requiring file-symlink privileges.
+ const link = path.join(work, 'linked');
+ await fs.symlink(state.root, link, 'junction');
+ source = path.join(link, 'private.png');
+ } else await fs.symlink(outside, source);
+ expect(await fs.realpath(source)).toBe(await fs.realpath(outside));
} else await fs.writeFile(source, kind === 'not-image' ? Buffer.from('not png') : PNG);
const row = insert(`![image](${source})`);
expect(await restoreTaskImageRows(client, [row])).toEqual([row]);