summary refs log tree commit diff
path: root/synapse/media/media_repository.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/media/media_repository.py')
-rw-r--r--synapse/media/media_repository.py5
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