mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 02:18:25 +00:00
fix(image): propagate workspace root for image allowlist (#16722)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: 24a13675cb
Co-authored-by: steipete <58493+steipete@users.noreply.github.com>
Co-authored-by: steipete <58493+steipete@users.noreply.github.com>
Reviewed-by: @steipete
This commit is contained in:
committed by
GitHub
parent
69dd1a31bf
commit
b79e7fdb7a
@@ -358,9 +358,14 @@ export function createImageTool(options?: {
|
||||
if (!workspaceDir) {
|
||||
return roots;
|
||||
}
|
||||
const normalized = workspaceDir.startsWith("~") ? resolveUserPath(workspaceDir) : workspaceDir;
|
||||
if (!roots.includes(normalized)) {
|
||||
roots.push(normalized);
|
||||
const expanded = workspaceDir.startsWith("~") ? resolveUserPath(workspaceDir) : workspaceDir;
|
||||
const resolved = path.resolve(expanded);
|
||||
// Defensive: never allow "/" as an implicit media root.
|
||||
if (resolved === path.parse(resolved).root) {
|
||||
return roots;
|
||||
}
|
||||
if (!roots.includes(resolved)) {
|
||||
roots.push(resolved);
|
||||
}
|
||||
return roots;
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user