mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
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:
committed by
GitHub
parent
282fb9ad52
commit
afbce73570
@@ -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) {
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user