mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-15 17:51:10 +00:00
Ensure is_verified on /_matrix/client/r0/room_keys/keys is a boolean (#7150)
This commit is contained in:
parent
fbf0782c63
commit
12aa5a7fa7
3 changed files with 4 additions and 2 deletions
1
changelog.d/7150.bugfix
Normal file
1
changelog.d/7150.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Ensure `is_verified` is a boolean in responses to `GET /_matrix/client/r0/room_keys/keys`. Also warn the user if they forgot the `version` query param.
|
|
@ -188,7 +188,7 @@ class RoomKeysServlet(RestServlet):
|
||||||
"""
|
"""
|
||||||
requester = await self.auth.get_user_by_req(request, allow_guest=False)
|
requester = await self.auth.get_user_by_req(request, allow_guest=False)
|
||||||
user_id = requester.user.to_string()
|
user_id = requester.user.to_string()
|
||||||
version = parse_string(request, "version")
|
version = parse_string(request, "version", required=True)
|
||||||
|
|
||||||
room_keys = await self.e2e_room_keys_handler.get_room_keys(
|
room_keys = await self.e2e_room_keys_handler.get_room_keys(
|
||||||
user_id, version, room_id, session_id
|
user_id, version, room_id, session_id
|
||||||
|
|
|
@ -146,7 +146,8 @@ class EndToEndRoomKeyStore(SQLBaseStore):
|
||||||
room_entry["sessions"][row["session_id"]] = {
|
room_entry["sessions"][row["session_id"]] = {
|
||||||
"first_message_index": row["first_message_index"],
|
"first_message_index": row["first_message_index"],
|
||||||
"forwarded_count": row["forwarded_count"],
|
"forwarded_count": row["forwarded_count"],
|
||||||
"is_verified": row["is_verified"],
|
# is_verified must be returned to the client as a boolean
|
||||||
|
"is_verified": bool(row["is_verified"]),
|
||||||
"session_data": json.loads(row["session_data"]),
|
"session_data": json.loads(row["session_data"]),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue