





















@@ -4,6 +4,25 @@ import * as os from "node:os";
44import * as path from "node:path";
55import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
667+async function probeFileSymlinkCapability(): Promise<boolean> {
8+const probeDir = await fs.promises.mkdtemp(
9+path.join(os.tmpdir(), "openclaw-qqbot-symlink-probe-"),
10+);
11+const targetFile = path.join(probeDir, "target.txt");
12+const linkFile = path.join(probeDir, "link.txt");
13+try {
14+await fs.promises.writeFile(targetFile, "content");
15+await fs.promises.symlink(targetFile, linkFile);
16+return true;
17+} catch {
18+return false;
19+} finally {
20+await fs.promises.rm(probeDir, { recursive: true, force: true });
21+}
22+}
23+24+const canCreateFileSymlinks = await probeFileSymlinkCapability();
25+726const adapterMocks = vi.hoisted(() => ({
827fetchMedia: vi.fn(),
928}));
@@ -97,7 +116,7 @@ describe("qqbot file-utils downloadFile", () => {
97116expect(adapterMocks.fetchMedia).not.toHaveBeenCalled();
98117});
99118100-it.skipIf(process.platform === "win32")("rejects symlinked local media helpers", async () => {
119+it.skipIf(!canCreateFileSymlinks)("rejects symlinked local media helpers", async () => {
101120const targetPath = path.join(tempDir, "target.png");
102121const linkPath = path.join(tempDir, "link.png");
103122await fs.promises.writeFile(targetPath, "image-bytes");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。