From dd2a7397a4620b791486596fcf6d8264826e2eed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20K=C3=B6sters?= Date: Mon, 15 Mar 2021 22:25:51 +0100 Subject: [PATCH] fix: make cross signing work with server names containing : Server names are allowed to contain ':' to specify a port, see https://matrix.org/docs/spec/appendices#server-name User ids on the other hand are not allowed to contain ':', even historical user ids, see https://matrix.org/docs/spec/appendices#historical-user-ids Therefore we can use the first instance of ':' to split the user localpart from the server name. --- CHANGES.md | 1 + .../org/matrix/android/sdk/internal/crypto/DeviceListManager.kt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index e4ff049550..d70e264cad 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -47,6 +47,7 @@ Bugfix šŸ›: - Be robust if Event.type is missing (#2946) - Snappier message send status - Fix MainActivity display (#2927) + - Cross signing now works with servers with an explicit port in the servername Translations šŸ—£: - All string resources and translations have been moved to the application module. Weblate project for the SDK will be removed. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DeviceListManager.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DeviceListManager.kt index 42df6b354b..92a08dfe60 100755 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DeviceListManager.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DeviceListManager.kt @@ -104,7 +104,7 @@ internal class DeviceListManager @Inject constructor(private val cryptoStore: IM if (':' in userId) { try { synchronized(notReadyToRetryHS) { - res = !notReadyToRetryHS.contains(userId.substringAfterLast(':')) + res = !notReadyToRetryHS.contains(userId.substringAfter(':')) } } catch (e: Exception) { Timber.e(e, "## CRYPTO |Ā canRetryKeysDownload() failed")