Improve (unused) code

This commit is contained in:
Benoit Marty 2020-08-20 17:57:48 +02:00
parent cab447e44e
commit 112a7913d4
1 changed files with 4 additions and 5 deletions

View File

@ -43,10 +43,9 @@ internal class DefaultPermalinkService @Inject constructor(
}
override fun getLinkedId(url: String): String? {
val isSupported = url.startsWith(MATRIX_TO_URL_BASE)
return if (isSupported) {
url.substring(MATRIX_TO_URL_BASE.length)
} else null
return url
.takeIf { it.startsWith(MATRIX_TO_URL_BASE) }
?.substring(MATRIX_TO_URL_BASE.length)
?.substringBeforeLast("?")
}
}