Skip to content

Commit

Permalink
Close the file before trying to read file size
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston committed May 30, 2024
1 parent 152f998 commit efc0efa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions synapse/media/media_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,11 @@ async def _generate_thumbnails(
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
Expand Down

0 comments on commit efc0efa

Please sign in to comment.