Skip to content

Commit 2a049df

Browse files
authored
Merge pull request aden-hive#1540 from jaffarkeikei/fix/list-dir-isdir-check
fix(list_dir): add isdir check before listing
2 parents 095dd05 + 8923011 commit 2a049df

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • tools/src/aden_tools/tools/file_system_toolkits/list_dir

tools/src/aden_tools/tools/file_system_toolkits/list_dir/list_dir.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ def list_dir(path: str, workspace_id: str, agent_id: str, session_id: str) -> di
3636
try:
3737
secure_path = get_secure_path(path, workspace_id, agent_id, session_id)
3838
if not os.path.exists(secure_path):
39-
return {"error": f"Directory not found at {path}"}
39+
return {"error": f"Path not found: {path}"}
40+
41+
if not os.path.isdir(secure_path):
42+
return {"error": f"Path is not a directory: {path}"}
4043

4144
items = os.listdir(secure_path)
4245
entries = []

0 commit comments

Comments
 (0)