fix: use os.tmpdir fallback paths for temp files (#14985)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 347c689407
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
Gustavo Madeira Santana
2026-02-12 16:08:41 -05:00
committed by GitHub
parent 282fb9ad52
commit afbce73570
5 changed files with 19 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
import type { Page } from "playwright-core";
import crypto from "node:crypto";
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import {
ensurePageState,
@@ -20,7 +21,7 @@ import {
function buildTempDownloadPath(fileName: string): string {
const id = crypto.randomUUID();
const safeName = fileName.trim() ? fileName.trim() : "download.bin";
return path.join("/tmp/openclaw/downloads", `${id}-${safeName}`);
return path.join(os.tmpdir(), "openclaw", "downloads", `${id}-${safeName}`);
}
function createPageDownloadWaiter(page: Page, timeoutMs: number) {

View File

@@ -1,5 +1,6 @@
import crypto from "node:crypto";
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import type { BrowserRouteContext } from "../server-context.js";
import type { BrowserRouteRegistrar } from "./types.js";
@@ -131,7 +132,7 @@ export function registerBrowserAgentDebugRoutes(
return;
}
const id = crypto.randomUUID();
const dir = "/tmp/openclaw";
const dir = path.join(os.tmpdir(), "openclaw");
await fs.mkdir(dir, { recursive: true });
const tracePath = out.trim() || path.join(dir, `browser-trace-${id}.zip`);
await pw.traceStopViaPlaywright({