Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
WIP e2e key backups
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dbkr committed Sep 13, 2018
1 parent 3801b8a commit bc74925
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions synapse/rest/client/v2_alpha/room_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

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,
Expand Down Expand Up @@ -324,9 +324,15 @@ def on_GET(self, request, version):
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
Expand Down

0 comments on commit bc74925

Please sign in to comment.