diff options
author | Erik Johnston <erikj@element.io> | 2024-05-30 11:22:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-30 11:22:19 +0100 |
commit | 8bd9ff0783c26d9ce4d08b396e5620c57eef2e67 (patch) | |
tree | 05854c4018b2b9005a51bb52095e8c5b629950c7 /synapse/media/media_repository.py | |
parent | Move towards using `MultiWriterIdGenerator` everywhere (#17226) (diff) | |
download | synapse-8bd9ff0783c26d9ce4d08b396e5620c57eef2e67.tar.xz |
Ensure we delete media if we reject due to spam check (#17246)
Fixes up #17239 We need to keep the spam check within the `try/except` block. Also makes it so that we don't enter the top span twice. Also also ensures that we get the right thumbnail length.
Diffstat (limited to 'synapse/media/media_repository.py')
-rw-r--r-- | synapse/media/media_repository.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/media/media_repository.py b/synapse/media/media_repository.py index 9da8495950..9c29e09653 100644 --- a/synapse/media/media_repository.py +++ b/synapse/media/media_repository.py @@ -1049,6 +1049,11 @@ class MediaRepository: finally: t_byte_source.close() + # We flush and close the file to ensure that the bytes have + # been written before getting the size. + f.flush() + f.close() + t_len = os.path.getsize(fname) # Write to database |