Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Allow absolute paths if contained in workspace (#3932)

Stefan Ayalac1cd54d1ea98
diff --git a/autogpt/workspace/workspace.py b/autogpt/workspace/workspace.py
index c1050230a8..1589a5be9d 100644
--- a/autogpt/workspace/workspace.py
+++ b/autogpt/workspace/workspace.py
@@ -120,7 +120,8 @@ class Workspace:
logger.debug(f"Resolved root as '{root}'")
- if relative_path.is_absolute():
+ # Allow exception for absolute paths if they are contained in your workspace directory.
+ if relative_path.is_absolute() and not relative_path.is_relative_to(root):
raise ValueError(
f"Attempted to access absolute path '{relative_path}' in workspace '{root}'."
)