From 2f6e4ca60a5d08241cf4091a24087400f3e626fa Mon Sep 17 00:00:00 2001 From: Narasimha-sc <166327228+Narasimha-sc@users.noreply.github.com> Date: Mon, 20 Jul 2026 16:29:02 +0000 Subject: [PATCH] multiplatform: trim pasted migration link before reading its network config MigrateToDevice.checkUserLink checked link.trim() and stored link.trim() in every MigrationToState payload, but passed the raw link to MigrationFileLinkData.readFromLink. A migration link pasted (or scanned) with leading whitespace, or with trailing non-ASCII whitespace such as a no- break space, passed the check but its "/_download info" request failed to parse or returned no network settings, so readFromLink returned null and the link's network settings were silently dropped: "Confirm network settings" was skipped, the archive downloaded without the link's SOCKS proxy, and the proxy stayed off after migration. Compute the trimmed link once and use it throughout, so classification and consumption see the same string. --- .../simplex/common/views/migration/MigrateToDevice.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/migration/MigrateToDevice.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/migration/MigrateToDevice.kt index 150be7ea6b..1b8e847b68 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/migration/MigrateToDevice.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/migration/MigrateToDevice.kt @@ -524,17 +524,18 @@ private fun ProgressView() { } private suspend fun MutableState.checkUserLink(link: String): Boolean { - return if (strHasSimplexFileLink(link.trim())) { - val data = MigrationFileLinkData.readFromLink(link) + val trimmed = link.trim() + return if (strHasSimplexFileLink(trimmed)) { + val data = MigrationFileLinkData.readFromLink(trimmed) val hasProxyConfigured = data?.networkConfig?.hasProxyConfigured() ?: false val networkConfig = data?.networkConfig?.transformToPlatformSupported() // If any of iOS or Android had onion enabled, show onion screen if (hasProxyConfigured && networkConfig?.hostMode != null && networkConfig.requiredHostMode != null) { - state = MigrationToState.Onion(link.trim(), networkConfig.legacySocksProxy, networkConfig.networkProxy, networkConfig.hostMode, networkConfig.requiredHostMode) - MigrationToDeviceState.save(MigrationToDeviceState.Onion(link.trim(), networkConfig.legacySocksProxy, networkConfig.networkProxy, networkConfig.hostMode, networkConfig.requiredHostMode)) + state = MigrationToState.Onion(trimmed, networkConfig.legacySocksProxy, networkConfig.networkProxy, networkConfig.hostMode, networkConfig.requiredHostMode) + MigrationToDeviceState.save(MigrationToDeviceState.Onion(trimmed, networkConfig.legacySocksProxy, networkConfig.networkProxy, networkConfig.hostMode, networkConfig.requiredHostMode)) } else { val current = getNetCfg() - state = MigrationToState.DatabaseInit(link.trim(), current.copy( + state = MigrationToState.DatabaseInit(trimmed, current.copy( socksProxy = null, hostMode = networkConfig?.hostMode ?: current.hostMode, requiredHostMode = networkConfig?.requiredHostMode ?: current.requiredHostMode