Skip to content

Commit

Permalink
prevent 500 server error on a just removed folder when listing files (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tobitege authored Aug 23, 2024
1 parent 8d47ceb commit fc5f026
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions openhands/runtime/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,10 +605,8 @@ async def list_files(request: Request):
full_path = os.path.join(client.initial_pwd, path)

if not os.path.exists(full_path):
return JSONResponse(
content={'error': f'Directory {full_path} does not exist'},
status_code=400,
)
# if user just removed a folder, prevent server error 500 in UI
return []

try:
# Check if the directory exists
Expand Down

0 comments on commit fc5f026

Please sign in to comment.