From 9bff73e9abd53204e245c2aafece52d21b6051b4 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 30 Nov 2024 17:16:39 +0100 Subject: [PATCH] Simplify https://github.com/readrops/Readrops/pull/231#issuecomment-2509005818 --- .../main/java/com/readrops/api/services/Credentials.kt | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/api/src/main/java/com/readrops/api/services/Credentials.kt b/api/src/main/java/com/readrops/api/services/Credentials.kt index bdadcf0f..7c01cd50 100644 --- a/api/src/main/java/com/readrops/api/services/Credentials.kt +++ b/api/src/main/java/com/readrops/api/services/Credentials.kt @@ -13,15 +13,11 @@ abstract class Credentials(val authorization: String?, val url: String) { companion object { fun toCredentials(account: Account): Credentials { val endPoint = getEndPoint(account.type!!).removePrefix("/") - var accountUrl = account.url!! - if (!accountUrl.endsWith("/")) { - accountUrl += "/" - } return when (account.type) { - AccountType.NEXTCLOUD_NEWS -> NextcloudNewsCredentials(account.login, account.password, accountUrl + endPoint) - AccountType.FRESHRSS -> FreshRSSCredentials(account.token, accountUrl + endPoint) - AccountType.FEVER -> FeverCredentials(account.login, account.password, accountUrl + endPoint) + AccountType.NEXTCLOUD_NEWS -> NextcloudNewsCredentials(account.login, account.password, account.url + endPoint) + AccountType.FRESHRSS -> FreshRSSCredentials(account.token, account.url + endPoint) + AccountType.FEVER -> FeverCredentials(account.login, account.password, account.url + endPoint) else -> throw IllegalArgumentException("Unknown account type") } }