From c328887e823c0c6c03083ffb345691d175e1bd20 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 gated on link.trim() and stored link.trim() in every MigrationToState payload, but passed the raw, untrimmed link to MigrationFileLinkData.readFromLink. A migration link pasted (or scanned) with leading whitespace therefore passed the gate, then failed the "/_download info" parse in the core, so readFromLink returned null and the link's network configuration was silently dropped: the onion screen was skipped and migration proceeded with the device's own host modes instead of the link's. 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 f92a5e0ce4..6887f89999 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