























@@ -28,7 +28,14 @@ describe("image-ops temp dir", () => {
28282929expect(fs.mkdtemp).toHaveBeenCalledTimes(1);
3030const [prefix] = vi.mocked(fs.mkdtemp).mock.calls[0] ?? [];
31-expect(prefix).toEqual(expect.stringMatching(/^.+openclaw-img-[0-9a-f-]+-$/u));
31+expect(typeof prefix).toBe("string");
32+const uuidPrefix = path.join(secureRoot, "openclaw-img-");
33+expect(prefix?.startsWith(uuidPrefix)).toBe(true);
34+expect(prefix?.endsWith("-")).toBe(true);
35+const uuid = prefix?.slice(uuidPrefix.length, -1) ?? "";
36+expect(uuid).toHaveLength(36);
37+expect([...uuid].every((char) => /[0-9a-f-]/u.test(char))).toBe(true);
38+expect([8, 13, 18, 23].map((index) => uuid[index])).toEqual(["-", "-", "-", "-"]);
3239expect(path.dirname(prefix ?? "")).toBe(secureRoot);
3340expect(createdTempDir.startsWith(prefix ?? "")).toBe(true);
3441let accessError: unknown;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。