diff --git a/federation/entities/matrix/entities.py b/federation/entities/matrix/entities.py index 7091671..b81fedb 100644 --- a/federation/entities/matrix/entities.py +++ b/federation/entities/matrix/entities.py @@ -144,6 +144,8 @@ class MatrixRoomMessage(Post, MatrixEntityMixin): logger.warning("MatrixRoomMessage.pre_send | Failed to upload image %s: %s", url, ex) continue + finally: + os.unlink(image_file) # Replace in raw content try: logger.debug("MatrixRoomMessage.pre_send | Got response %s", response.json())