Remove redundant trim from base URL VM
This commit is contained in:
@@ -36,9 +36,9 @@ class BaseURLViewModel @Inject constructor(
|
|||||||
|
|
||||||
val hasPrefix = ALLOWED_PREFIXES.any { baseURL.startsWith(it) }
|
val hasPrefix = ALLOWED_PREFIXES.any { baseURL.startsWith(it) }
|
||||||
val urlWithPrefix = baseURL.takeIf { hasPrefix } ?: WITH_PREFIX_FORMAT.format(baseURL)
|
val urlWithPrefix = baseURL.takeIf { hasPrefix } ?: WITH_PREFIX_FORMAT.format(baseURL)
|
||||||
val url = urlWithPrefix.trimStart().trimEnd { it == '/' || it.isWhitespace() }
|
val url = urlWithPrefix.trimEnd { it == '/' }
|
||||||
|
|
||||||
logger.d { "checkBaseURL: Created URL = $url, with prefix = $urlWithPrefix" }
|
logger.d { "checkBaseURL: Created URL = \"$url\", with prefix = \"$urlWithPrefix\"" }
|
||||||
if (url == serverInfoRepo.getUrl()) {
|
if (url == serverInfoRepo.getUrl()) {
|
||||||
logger.d { "checkBaseURL: new URL matches current" }
|
logger.d { "checkBaseURL: new URL matches current" }
|
||||||
_uiState.value = OperationUiState.fromResult(Result.success(Unit))
|
_uiState.value = OperationUiState.fromResult(Result.success(Unit))
|
||||||
|
|||||||
Reference in New Issue
Block a user