Skip to content

Commit

Permalink
Fix for issue where S3FileStore does not delete directory objects (Al…
Browse files Browse the repository at this point in the history
  • Loading branch information
tofarr authored and AlexCuadron committed Jan 13, 2025
1 parent 195093a commit 940095e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion openhands/storage/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ def list(self, path: str) -> list[str]:

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}')

0 comments on commit 940095e

Please sign in to comment.