key upload tweaks

1. Add v2_alpha URL back in, since things seem to be using it.

2. Don't reject the request if the device_id in the upload request fails to
   match that in the access_token.
This commit is contained in:
Richard van der Hoff 2016-07-27 16:41:06 +01:00
parent 26cb0efa88
commit ccec25e2c6

View File

@ -55,7 +55,7 @@ class KeyUploadServlet(RestServlet):
} }
""" """
PATTERNS = client_v2_patterns("/keys/upload(/(?P<device_id>[^/]+))?$", PATTERNS = client_v2_patterns("/keys/upload(/(?P<device_id>[^/]+))?$",
releases=(), v2_alpha=False) releases=())
def __init__(self, hs): def __init__(self, hs):
""" """
@ -78,14 +78,12 @@ class KeyUploadServlet(RestServlet):
if device_id is not None: if device_id is not None:
# passing the device_id here is deprecated; however, we allow it # passing the device_id here is deprecated; however, we allow it
# for now for compatibility with older clients. But if a device_id # for now for compatibility with older clients.
# was given here and in the auth, they must match.
if (requester.device_id is not None and if (requester.device_id is not None and
device_id != requester.device_id): device_id != requester.device_id):
raise synapse.api.errors.SynapseError( logger.warning("Client uploading keys for a different device "
400, "Can only upload keys for current device" "(logged in as %s, uploading for %s)",
) requester.device_id, device_id)
else: else:
device_id = requester.device_id device_id = requester.device_id