mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 13:01:25 +00:00
fix: allow agent workspace directories in media local roots (#17136)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: 7545ef1e19
Co-authored-by: MisterGuy420 <255743668+MisterGuy420@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import type { SsrFPolicy } from "../infra/net/ssrf.js";
|
||||
import { STATE_DIR } from "../config/paths.js";
|
||||
import { logVerbose, shouldLogVerbose } from "../globals.js";
|
||||
import { type MediaKind, maxBytesForKind, mediaKindFromMime } from "../media/constants.js";
|
||||
import { fetchRemoteMedia } from "../media/fetch.js";
|
||||
@@ -13,6 +11,7 @@ import {
|
||||
optimizeImageToPng,
|
||||
resizeToJpeg,
|
||||
} from "../media/image-ops.js";
|
||||
import { getDefaultMediaLocalRoots } from "../media/local-roots.js";
|
||||
import { detectMime, extensionForMime } from "../media/mime.js";
|
||||
import { resolveUserPath } from "../utils.js";
|
||||
|
||||
@@ -35,13 +34,7 @@ type WebMediaOptions = {
|
||||
};
|
||||
|
||||
export function getDefaultLocalRoots(): readonly string[] {
|
||||
return [
|
||||
os.tmpdir(),
|
||||
path.join(STATE_DIR, "media"),
|
||||
path.join(STATE_DIR, "agents"),
|
||||
path.join(STATE_DIR, "workspace"),
|
||||
path.join(STATE_DIR, "sandboxes"),
|
||||
];
|
||||
return getDefaultMediaLocalRoots();
|
||||
}
|
||||
|
||||
async function assertLocalMediaAllowed(
|
||||
|
||||
Reference in New Issue
Block a user