mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(backend/copilot): use resolved path for bridging, explicit return None
- Pass `resolved` (realpath-expanded) to `_bridge_to_sandbox` in `_read_file_handler` so the bridge target matches the file that was actually read (addresses review comment). - Replace bare `return` with explicit `return None` in `_bridge_to_sandbox` large-file skip path for consistency with the declared `str | None` return type.
This commit is contained in:
@@ -355,7 +355,7 @@ async def _bridge_to_sandbox(
|
||||
file_size,
|
||||
basename,
|
||||
)
|
||||
return
|
||||
return None
|
||||
with open(expanded, "rb") as fh:
|
||||
content = fh.read()
|
||||
if file_size <= _BRIDGE_SHELL_MAX_BYTES:
|
||||
|
||||
@@ -393,7 +393,7 @@ async def _read_file_handler(args: dict[str, Any]) -> dict[str, Any]:
|
||||
text = "".join(selected)
|
||||
sandbox = _current_sandbox.get(None)
|
||||
if sandbox is not None:
|
||||
bridged = await _bridge_to_sandbox(sandbox, file_path, offset, limit)
|
||||
bridged = await _bridge_to_sandbox(sandbox, resolved, offset, limit)
|
||||
if bridged:
|
||||
text += f"\n[Sandbox copy available at {bridged}]"
|
||||
return _mcp_ok(text)
|
||||
|
||||
Reference in New Issue
Block a user