diff options
author | Erik Johnston <erikj@element.io> | 2024-05-29 11:14:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-29 11:14:42 +0100 |
commit | bb5a692946e69c7f3686f1cb3fc0833b736f066a (patch) | |
tree | 6fccac75d6c8b4205d5eb1129a2e17003d60aeaf /synapse/media/url_previewer.py | |
parent | Merge branch 'master' into develop (diff) | |
download | synapse-bb5a692946e69c7f3686f1cb3fc0833b736f066a.tar.xz |
Fix slipped logging context when media rejected (#17239)
When a module rejects a piece of media we end up trying to close the same logging context twice. Instead of fixing the existing code we refactor to use an async context manager, which is easier to write correctly.
Diffstat (limited to 'synapse/media/url_previewer.py')
-rw-r--r-- | synapse/media/url_previewer.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/synapse/media/url_previewer.py b/synapse/media/url_previewer.py index 3897823b35..2e65a04789 100644 --- a/synapse/media/url_previewer.py +++ b/synapse/media/url_previewer.py @@ -592,7 +592,7 @@ class UrlPreviewer: file_info = FileInfo(server_name=None, file_id=file_id, url_cache=True) - with self.media_storage.store_into_file(file_info) as (f, fname, finish): + async with self.media_storage.store_into_file(file_info) as (f, fname): if url.startswith("data:"): if not allow_data_urls: raise SynapseError( @@ -603,8 +603,6 @@ class UrlPreviewer: else: download_result = await self._download_url(url, f) - await finish() - try: time_now_ms = self.clock.time_msec() |