From 45d5fd5c5a962bd7507280e9187c106c97206b0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20S=C3=B8borg?= Date: Sun, 28 Jan 2024 20:53:40 +0100 Subject: [PATCH] uploadRoomKeysToBackup: Use V3 route MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes https://github.com/element-hq/hydrogen-web/issues/741 "Tested" locally by rewriting `r0` to `v3` in reverse proxy (Caddy) and seeing `All keys are backed up.` instead of repeated failing PUT requests towards Conduit (home server) ``` matrix.example.com { rewrite /_matrix/client/r0/room_keys/keys /_matrix/client/v3/room_keys/keys?{query} reverse_proxy /_matrix/* localhost:8448 } ``` Signed-off-by: Nicolai Søborg --- src/matrix/net/HomeServerApi.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/matrix/net/HomeServerApi.ts b/src/matrix/net/HomeServerApi.ts index eebc692acd..583f9f0967 100644 --- a/src/matrix/net/HomeServerApi.ts +++ b/src/matrix/net/HomeServerApi.ts @@ -251,7 +251,8 @@ export class HomeServerApi { return this._get(`/room_keys/keys/${encodeURIComponent(roomId)}/${encodeURIComponent(sessionId)}`, {version}, undefined, options); } - uploadRoomKeysToBackup(version: string, payload: Record, options?: BaseRequestOptions): IHomeServerRequest { + uploadRoomKeysToBackup(version: string, payload: Record, options: BaseRequestOptions = {}): IHomeServerRequest { + options.prefix = CS_V3_PREFIX; return this._put(`/room_keys/keys`, {version}, payload, options); }