瀏覽代碼

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

* revert change in file action

* remove useless code

* make lint
Yufan Song 1 年之前
父節點
當前提交
06a6ffcb09
共有 2 個文件被更改,包括 0 次插入75 次删除
  1. 0 46
      opendevin/runtime/files.py
  2. 0 29
      opendevin/runtime/server/files.py

+ 0 - 46
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

+ 0 - 29
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