π OpenHands: AI-Driven Development
Fix for issue where S3FileStore does not delete directory objects (#6231)
tofarr5b1dcf83a608
diff --git a/openhands/storage/s3.py b/openhands/storage/s3.pyindex b571d4288c..76db87dc63 100644--- a/openhands/storage/s3.py+++ b/openhands/storage/s3.py@@ -41,6 +41,10 @@ class S3FileStore(FileStore):def delete(self, path: str) -> None:try:- self.client.remove_object(self.bucket, path)+ client = self.client+ bucket = self.bucket+ objects_to_delete = client.list_objects(bucket, prefix=path, recursive=True)+ for obj in objects_to_delete:+ client.remove_object(bucket, obj.object_name)except Exception as e:raise FileNotFoundError(f'Failed to delete S3 object at path {path}: {e}')