mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-04 21:37:45 +00:00
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.
This commit is contained in:
1 parent
139ce5f8cc
commit
2f6e4ca60a
1 file changed
+6
-5
+6
-5
@@ -524,17 +524,18 @@ private fun ProgressView() {
|
||||
}
|
||||
|
||||
private suspend fun MutableState<MigrationToState?>.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
|
||||
|
||||
Reference in new issue
Block a user