π OpenHands: AI-Driven Development
fix file chunking corruption (#7338)
diwu-sf3856a896eab5
diff --git a/openhands/runtime/impl/action_execution/action_execution_client.py b/openhands/runtime/impl/action_execution/action_execution_client.pyindex bcdbe2be15..0432c74665 100644--- a/openhands/runtime/impl/action_execution/action_execution_client.py+++ b/openhands/runtime/impl/action_execution/action_execution_client.py@@ -1,5 +1,4 @@import os-import shutilimport tempfileimport threadingfrom abc import abstractmethod@@ -149,7 +148,10 @@ class ActionExecutionClient(Runtime):with tempfile.NamedTemporaryFile(suffix='.zip', delete=False) as temp_file:- shutil.copyfileobj(response.raw, temp_file, length=16 * 1024)+ for chunk in response.iter_content(chunk_size=16 * 1024):+ if chunk: # filter out keep-alive new chunks+ temp_file.write(chunk)+ temp_file.flush()return Path(temp_file.name)except requests.Timeout:raise TimeoutError('Copy operation timed out')