From 0155b0650df5cbd627b715bb753e6f29c1e5fa50 Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Tue, 14 Jan 2025 12:53:52 +0100 Subject: [PATCH 1/2] Remove trailing slash at the end of identity server Signed-off-by: Nicolas Buquet --- MatrixSDK/MXSession.m | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MatrixSDK/MXSession.m b/MatrixSDK/MXSession.m index 18550d042..303531ce9 100644 --- a/MatrixSDK/MXSession.m +++ b/MatrixSDK/MXSession.m @@ -832,6 +832,15 @@ - (void)handleSyncResponse:(MXSyncResponse *)syncResponse - (void)setIdentityServer:(NSString *)identityServer andAccessToken:(NSString *)accessToken { + // Old Account data can have a trailing slash at the end of their Identity Server. + // This can lead to unrecognized URL on the backend (like on 'invite to room') because the URL is then constructed + // with a double slash in its path. + // This leads to error 500 for these calls. + // So, fix this trailing slash as soon as we receive it. + if ([identityServer hasSuffix:@"/"]) { + identityServer = [identityServer substringToIndex:identityServer.length-1]; + } + MXLogDebug(@"[MXSession] setIdentityServer: %@", identityServer); matrixRestClient.identityServer = identityServer; From 3807109b2f50c0947845d13b000b6b4d1fdd01e5 Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Tue, 14 Jan 2025 14:27:55 +0100 Subject: [PATCH 2/2] Add changelog Signed-off-by: Nicolas Buquet --- changelog.d/pr-1898.change | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/pr-1898.change diff --git a/changelog.d/pr-1898.change b/changelog.d/pr-1898.change new file mode 100644 index 000000000..c3c51064f --- /dev/null +++ b/changelog.d/pr-1898.change @@ -0,0 +1 @@ +Remove trailing slash at the end of identity server. \ No newline at end of file