fix(webui): respect full access in file preview

This commit is contained in:
chengyongru
2026-07-09 10:42:43 +08:00
committed by Xubin Ren
parent 0ae28571e7
commit bbd4f4054b
2 changed files with 40 additions and 3 deletions
+2 -2
View File
@@ -28,7 +28,7 @@ def file_preview_payload(
scope: WorkspaceScope,
max_bytes: int = MAX_FILE_PREVIEW_BYTES,
) -> dict[str, Any]:
"""Return a text preview for a file inside the session workspace."""
"""Return a text preview for a file allowed by the session workspace scope."""
path = _clean_preview_path(raw_path)
if not path:
@@ -40,7 +40,7 @@ def file_preview_payload(
resolved = resolve_allowed_path(
path,
workspace=scope.project_path,
allowed_root=scope.project_path,
allowed_root=scope.project_path if scope.restrict_to_workspace else None,
strict=True,
)
except FileNotFoundError as e: