Skip to content

πŸ™Œ OpenHands: AI-Driven Development

feat: revert hiden special paths change in file action (#2328)

Yufan Song06a6ffcb09e3
diff --git a/opendevin/runtime/files.py b/opendevin/runtime/files.py
index 0b9ef1860b..6d5b96ac3e 100644
--- a/opendevin/runtime/files.py
+++ b/opendevin/runtime/files.py
@@ -1,4 +1,3 @@
-from pathlib import Path
from typing import Any
@@ -20,48 +19,3 @@ class WorkspaceFile:
'name': self.name,
'children': [child.to_dict() for child in self.children],
}
-
-
-def get_folder_structure(workdir: Path) -> WorkspaceFile:
- """Gets the folder structure of a directory.
-
- Args:
- workdir: The directory path.
-
- Returns:
- The folder structure.
- """
- root = WorkspaceFile(name=workdir.name, children=[])
- for item in workdir.iterdir():
- if item.is_dir():
- # Ignore special folders
- if item.parts[-1] in (
- '.git',
- '.DS_Store',
- '.svn',
- '.hg',
- '.idea',
- '.vscode',
- '.settings',
- '.pytest_cache',
- '__pycache__',
- 'node_modules',
- 'vendor',
- 'build',
- 'dist',
- 'bin',
- 'logs',
- 'log',
- 'tmp',
- 'temp',
- 'coverage',
- 'venv',
- 'env',
- ):
- continue
- dir = get_folder_structure(item)
- if dir.children:
- root.children.append(dir)
- else:
- root.children.append(WorkspaceFile(name=item.name, children=[]))
- return root
diff --git a/opendevin/runtime/server/files.py b/opendevin/runtime/server/files.py
index 7298f2d5a1..a2c1e35b8c 100644
--- a/opendevin/runtime/server/files.py
+++ b/opendevin/runtime/server/files.py
@@ -33,35 +33,6 @@ def resolve_path(file_path, working_directory):
# Get path relative to host
path_in_host_workspace = Path(config.workspace_base) / path_in_workspace
- # Prevent special folders
- if path_in_host_workspace:
- path_obj = Path(path_in_host_workspace)
- if path_obj:
- if path_obj.parts[-1] in (
- '.git',
- '.DS_Store',
- '.svn',
- '.hg',
- '.idea',
- '.vscode',
- '.settings',
- '.pytest_cache',
- '__pycache__',
- 'node_modules',
- 'vendor',
- 'build',
- 'dist',
- 'bin',
- 'logs',
- 'log',
- 'tmp',
- 'temp',
- 'coverage',
- 'venv',
- 'env',
- ):
- raise PermissionError('Invalid path.')
-
return path_in_host_workspace