summary refs log tree commit diff
path: root/synapse/media/url_previewer.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2023-11-09 11:00:30 -0500
committerGitHub <noreply@github.com>2023-11-09 11:00:30 -0500
commitff716b483b07b21de72d999250fdf9397003a914 (patch)
tree466db8d8885737346c41457cee9bf8fc549d387a /synapse/media/url_previewer.py
parentBulk-invalidate e2e cached queries after claiming keys (#16613) (diff)
downloadsynapse-ff716b483b07b21de72d999250fdf9397003a914.tar.xz
Return attrs for more media repo APIs. (#16611)
Diffstat (limited to 'synapse/media/url_previewer.py')
-rw-r--r--synapse/media/url_previewer.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/synapse/media/url_previewer.py b/synapse/media/url_previewer.py

index 9b5a3dd5f4..44aac21de6 100644 --- a/synapse/media/url_previewer.py +++ b/synapse/media/url_previewer.py
@@ -240,15 +240,14 @@ class UrlPreviewer: cache_result = await self.store.get_url_cache(url, ts) if ( cache_result - and cache_result["expires_ts"] > ts - and cache_result["response_code"] / 100 == 2 + and cache_result.expires_ts > ts + and cache_result.response_code // 100 == 2 ): # It may be stored as text in the database, not as bytes (such as # PostgreSQL). If so, encode it back before handing it on. - og = cache_result["og"] - if isinstance(og, str): - og = og.encode("utf8") - return og + if isinstance(cache_result.og, str): + return cache_result.og.encode("utf8") + return cache_result.og # If this URL can be accessed via an allowed oEmbed, use that instead. url_to_download = url