From 75a309b35fb854f285e2aef9abc35b29394fa516 Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Fri, 13 Feb 2026 12:04:20 +0000 Subject: [PATCH] cleanup types --- synapse/appservice/api.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/synapse/appservice/api.py b/synapse/appservice/api.py index 3e8a09d1f6..ad0f74a6fa 100644 --- a/synapse/appservice/api.py +++ b/synapse/appservice/api.py @@ -554,12 +554,13 @@ class ApplicationServiceApi(SimpleHttpClient): Args: service: The application service to query. - query: An iterable of tuples of (user ID, device ID, algorithm). + url: The url to query for. + user_id: The user who is requesting the preview. Returns: - A map of device_keys/master_keys/self_signing_keys/user_signing_keys: + A unstructrued map of data from the application service OR + None if the service could not be contacted, or returned any other response. - device_keys is a map of user ID -> a map device ID -> device info. """ if service.url is None: return None @@ -574,6 +575,8 @@ class ApplicationServiceApi(SimpleHttpClient): {"user_id": user_id.to_string(), "url": url}, headers=self._get_headers(service), ) + # The response *must* be a JsonDict if successful. + assert isinstance(response, dict) except HttpResponseException as e: # The appservice doesn't support this endpoint. # Since the AS has opted into these requests, we warn if the AS squarks about unknown @@ -581,7 +584,7 @@ class ApplicationServiceApi(SimpleHttpClient): logger.warning("query_url_preview to %s received %s", uri, e.code) return None except Exception as ex: - logger.warning("query_keys to %s threw exception %s", uri, ex) + logger.warning("query_url_preview to %s threw exception %s", uri, ex) return None return response