fix(gui): Restore 'Load Log' button and fix docking crash
fix(mcp): Improve path resolution and error messages
This commit is contained in:
@@ -112,16 +112,14 @@ def _resolve_and_check(raw_path: str) -> tuple[Path | None, str]:
|
||||
p = Path(raw_path)
|
||||
if not p.is_absolute() and _primary_base_dir:
|
||||
p = _primary_base_dir / p
|
||||
try:
|
||||
p = p.resolve(strict=True)
|
||||
except (OSError, ValueError):
|
||||
p = p.resolve()
|
||||
p = p.resolve()
|
||||
except Exception as e:
|
||||
return None, f"ERROR: invalid path '{raw_path}': {e}"
|
||||
if not _is_allowed(p):
|
||||
allowed_bases = "\\n".join([f" - {d}" for d in _base_dirs])
|
||||
return None, (
|
||||
f"ACCESS DENIED: '{raw_path}' is not within the allowed paths. "
|
||||
f"Use list_directory or search_files on an allowed base directory first."
|
||||
f"ACCESS DENIED: '{raw_path}' resolves to '{p}', which is not within the allowed paths.\\n"
|
||||
f"Allowed base directories are:\\n{allowed_bases}"
|
||||
)
|
||||
return p, ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user