mirror of
https://github.com/larchanka/manbot.git
synced 2026-05-13 21:42:08 +00:00
Fix: Resolve relative paths in send_file to absolute paths in sandboxDir.
This commit is contained in:
committed by
Mikhail Larchanka
parent
56f0c965d0
commit
a1a59a610a
@@ -75,6 +75,7 @@ const SKILL_TOOLS: any[] = [
|
||||
];
|
||||
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { resolve, isAbsolute } from "node:path";
|
||||
import { BaseProcess } from "../shared/base-process.js";
|
||||
import type { CapabilityGraph, CapabilityNode } from "../shared/graph-utils.js";
|
||||
import {
|
||||
@@ -902,6 +903,11 @@ export class ExecutorAgent extends BaseProcess {
|
||||
if (localPath) localPath = resolveValue(localPath).trim();
|
||||
if (caption) caption = resolveValue(caption).trim();
|
||||
|
||||
// Resolve relative path against sandboxDir
|
||||
if (localPath && !isAbsolute(localPath) && !localPath.startsWith("http")) {
|
||||
localPath = resolve(getConfig().toolHost.sandboxDir, localPath);
|
||||
}
|
||||
|
||||
if (!localPath) {
|
||||
throw new Error("send_file requires local_path (or local_file_url)");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user