diff options
author | Erik Johnston <erik@matrix.org> | 2024-05-30 10:56:14 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2024-05-30 10:56:14 +0100 |
commit | 5e15d598ceb28f5c190f9277025757d0f82eef50 (patch) | |
tree | b3456cdb10e5b167f228907bc9ddd96253ba085e | |
parent | Force flush + close of FD (diff) | |
download | synapse-github/erikj/media_thumbnail_fix.tar.xz |
Close the file before trying to read file size github/erikj/media_thumbnail_fix erikj/media_thumbnail_fix
-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 |