π OpenHands: AI-Driven Development
fix saves (#3848)
Robert Brennan1f13d80ddc6b
diff --git a/openhands/server/listen.py b/openhands/server/listen.pyindex 1bef3b8189..5a3e725da6 100644--- a/openhands/server/listen.py+++ b/openhands/server/listen.py@@ -461,9 +461,8 @@ async def select_file(file: str, request: Request):HTTPException: If there's an error opening the file."""runtime: Runtime = request.state.session.agent_session.runtime- # prepend `/workspace`- file = os.path.join(runtime.config.workspace_mount_path_in_sandbox, file)+ file = os.path.join(runtime.config.workspace_mount_path_in_sandbox, file)read_action = FileReadAction(file)observation = runtime.run_action(read_action)@@ -701,15 +700,11 @@ async def save_file(request: Request):if not file_path or content is None:raise HTTPException(status_code=400, detail='Missing filePath or content')- # Make sure file_path is abs- if not os.path.isabs(file_path):- return JSONResponse(- status_code=status.HTTP_400_BAD_REQUEST,- content={'error': 'File path must be absolute'},- )-# Save the file to the agent's runtime file storeruntime: Runtime = request.state.session.agent_session.runtime+ file_path = os.path.join(+ runtime.config.workspace_mount_path_in_sandbox, file_path+ )write_action = FileWriteAction(file_path, content)observation = runtime.run_action(write_action)