diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/permalinks/PermalinkParser.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/permalinks/PermalinkParser.kt index dc47c81a5f..347a3bb531 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/permalinks/PermalinkParser.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/permalinks/PermalinkParser.kt @@ -44,13 +44,12 @@ object PermalinkParser { if (fragment.isNullOrEmpty()) { return PermalinkData.FallbackLink(uri) } - val indexOfQuery = fragment.indexOf("?") - val safeFragment = if (indexOfQuery != -1) fragment.substring(0, indexOfQuery) else fragment + val safeFragment = fragment.substringBefore('?') val viaQueryParameters = fragment.getViaParameters() // we are limiting to 2 params val params = safeFragment - .split(MatrixPatterns.SEP_REGEX.toRegex()) + .split(MatrixPatterns.SEP_REGEX) .filter { it.isNotEmpty() } .take(2)