mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-23 18:15:53 +03:00
WIP e2e key backups
Continues from uhoreg's branch This just fixed the errcode on /room_keys/version if no backup and updates the schema delta to be on the latest so it gets run
This commit is contained in:
parent
3801b8aa03
commit
bc74925c5b
2 changed files with 10 additions and 4 deletions
|
@ -17,7 +17,7 @@ import logging
|
||||||
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
from synapse.api.errors import SynapseError
|
from synapse.api.errors import SynapseError, Codes
|
||||||
from synapse.http.servlet import (
|
from synapse.http.servlet import (
|
||||||
RestServlet,
|
RestServlet,
|
||||||
parse_json_object_from_request,
|
parse_json_object_from_request,
|
||||||
|
@ -324,9 +324,15 @@ class RoomKeysVersionServlet(RestServlet):
|
||||||
requester = yield self.auth.get_user_by_req(request, allow_guest=False)
|
requester = yield self.auth.get_user_by_req(request, allow_guest=False)
|
||||||
user_id = requester.user.to_string()
|
user_id = requester.user.to_string()
|
||||||
|
|
||||||
info = yield self.e2e_room_keys_handler.get_version_info(
|
try:
|
||||||
user_id, version
|
info = yield self.e2e_room_keys_handler.get_version_info(
|
||||||
)
|
user_id, version
|
||||||
|
)
|
||||||
|
except SynapseError as e:
|
||||||
|
if e.code == 404:
|
||||||
|
e.errcode = Codes.NOT_FOUND
|
||||||
|
e.msg = "No backup found"
|
||||||
|
raise e
|
||||||
defer.returnValue((200, info))
|
defer.returnValue((200, info))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
|
Loading…
Reference in a new issue