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:
David Baker 2018-09-13 17:02:59 +01:00
parent 3801b8aa03
commit bc74925c5b
2 changed files with 10 additions and 4 deletions

View file

@ -17,7 +17,7 @@ import logging
from twisted.internet import defer
from synapse.api.errors import SynapseError
from synapse.api.errors import SynapseError, Codes
from synapse.http.servlet import (
RestServlet,
parse_json_object_from_request,
@ -324,9 +324,15 @@ class RoomKeysVersionServlet(RestServlet):
requester = yield self.auth.get_user_by_req(request, allow_guest=False)
user_id = requester.user.to_string()
info = yield self.e2e_room_keys_handler.get_version_info(
user_id, version
)
try:
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.inlineCallbacks