fix(shell): allow media directory access when restrict_to_workspace is enabled

This commit is contained in:
Shiniese
2026-04-04 03:03:58 +08:00
committed by Xubin Ren
parent ca3b918cf0
commit bc879386fe
+10 -1
View File
@@ -183,7 +183,16 @@ class ExecTool(Tool):
p = Path(expanded).expanduser().resolve()
except Exception:
continue
if p.is_absolute() and cwd_path not in p.parents and p != cwd_path:
from nanobot.config.paths import get_runtime_subdir
media_path = get_runtime_subdir("media").resolve()
if (p.is_absolute()
and cwd_path not in p.parents
and p != cwd_path
and media_path not in p.parents
and p != media_path
):
return "Error: Command blocked by safety guard (path outside working dir)"
return None