Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(webui): allow media directory access when restrictToWorkspace is enabled
seteiro4490f8cfe4d2
diff --git a/nanobot/webui/file_preview.py b/nanobot/webui/file_preview.pyindex dac0d0e35..af141be1b 100644--- a/nanobot/webui/file_preview.py+++ b/nanobot/webui/file_preview.py@@ -7,6 +7,7 @@ from pathlib import Pathfrom typing import Anyfrom urllib.parse import unquote, urlparse+from nanobot.config.paths import get_media_dirfrom nanobot.security.workspace_access import WorkspaceScopefrom nanobot.security.workspace_policy import WorkspaceBoundaryError, resolve_allowed_path@@ -86,10 +87,12 @@ def _resolve_preview_path(raw_path: str | None, *, scope: WorkspaceScope) -> Patraise WebUIFilePreviewError(400, "path is too long")try:+ extra_roots = [get_media_dir()] if scope.restrict_to_workspace else Noneresolved = resolve_allowed_path(path,workspace=scope.project_path,allowed_root=scope.project_path if scope.restrict_to_workspace else None,+ extra_allowed_roots=extra_roots,strict=True,)except FileNotFoundError as e: