mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-15 04:33:53 +01:00
Log if rejecting 3PE query metadata result due to type check
This commit is contained in:
parent
ed44c475d8
commit
776594f99d
1 changed files with 11 additions and 4 deletions
|
@ -32,6 +32,14 @@ HOUR_IN_MS = 60 * 60 * 1000
|
||||||
APP_SERVICE_PREFIX = "/_matrix/app/unstable"
|
APP_SERVICE_PREFIX = "/_matrix/app/unstable"
|
||||||
|
|
||||||
|
|
||||||
|
def _is_valid_3pe_metadata(info):
|
||||||
|
if "instances" not in info:
|
||||||
|
return False
|
||||||
|
if not isinstance(info["instances"], list):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def _is_valid_3pe_result(r, field):
|
def _is_valid_3pe_result(r, field):
|
||||||
if not isinstance(r, dict):
|
if not isinstance(r, dict):
|
||||||
return False
|
return False
|
||||||
|
@ -164,10 +172,9 @@ class ApplicationServiceApi(SimpleHttpClient):
|
||||||
try:
|
try:
|
||||||
info = yield self.get_json(uri, {})
|
info = yield self.get_json(uri, {})
|
||||||
|
|
||||||
# Ignore any result that doesn't contain an "instances" list
|
if not _is_valid_3pe_metadata(info):
|
||||||
if "instances" not in info:
|
logger.warning("query_3pe_protocol to %s did not return a"
|
||||||
defer.returnValue(None)
|
" valid result", uri)
|
||||||
if not isinstance(info["instances"], list):
|
|
||||||
defer.returnValue(None)
|
defer.returnValue(None)
|
||||||
|
|
||||||
defer.returnValue(info)
|
defer.returnValue(info)
|
||||||
|
|
Loading…
Reference in a new issue