mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-14 11:57:44 +00:00
Check status codes that profile handler returns (#8580)
Fixes #8520 Signed-off-by: Pavel Turinsky <pavel.turinsky@matfyz.cz> Co-authored-by: Erik Johnston <erikj@jki.re>
This commit is contained in:
parent
2b7c180879
commit
7b13780c54
2 changed files with 8 additions and 0 deletions
1
changelog.d/8580.bugfix
Normal file
1
changelog.d/8580.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
Fix a bug where Synapse would blindly forward bad responses from federation to clients when retrieving profile information.
|
|
@ -98,6 +98,13 @@ class ProfileHandler(BaseHandler):
|
|||
except RequestSendFailed as e:
|
||||
raise SynapseError(502, "Failed to fetch profile") from e
|
||||
except HttpResponseException as e:
|
||||
if e.code < 500 and e.code != 404:
|
||||
# Other codes are not allowed in c2s API
|
||||
logger.info(
|
||||
"Server replied with wrong response: %s %s", e.code, e.msg
|
||||
)
|
||||
|
||||
raise SynapseError(502, "Failed to fetch profile")
|
||||
raise e.to_synapse_error()
|
||||
|
||||
async def get_profile_from_cache(self, user_id: str) -> JsonDict:
|
||||
|
|
Loading…
Reference in a new issue