File tree Expand file tree Collapse file tree
apps/android/app/src/main/java/ai/openclaw/app/ui Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -162,12 +162,9 @@ internal fun parseGatewayEndpointResult(rawInput: String): GatewayEndpointParseR
162162 if (! tls && ! isLocalCleartextGatewayHost(host)) {
163163 return GatewayEndpointParseResult (error = GatewayEndpointValidationError .INSECURE_REMOTE_URL )
164164 }
165- if (uri.port != - 1 && uri.port !in 1 .. 65535 ) {
166- return GatewayEndpointParseResult (error = GatewayEndpointValidationError .INVALID_URL )
167- }
168165 val defaultPort = if (tls) 443 else 18789
169166 val displayPort = if (tls) 443 else 80
170- val port = uri.port. takeIf { it in 1 .. 65535 } ? : defaultPort
167+ val port = gatewayPort( uri.port, defaultPort) ? : return GatewayEndpointParseResult (error = GatewayEndpointValidationError . INVALID_URL )
171168 val displayHost = if (host.contains(" :" )) " [$host ]" else host
172169 val displayUrl =
173170 if (port == displayPort && defaultPort == displayPort) {
@@ -247,6 +244,13 @@ internal fun gatewayEndpointValidationMessage(
247244 }
248245 }
249246
247+ private fun gatewayPort (port : Int , defaultPort : Int ): Int? =
248+ when {
249+ port == - 1 -> defaultPort
250+ port in 1 .. 65535 -> port
251+ else -> null
252+ }
253+
250254/* * Builds a URL from manual host/port/tls fields for shared endpoint parsing. */
251255internal fun composeGatewayManualUrl (
252256 hostInput : String ,
You can’t perform that action at this time.
0 commit comments