Skip to content

Commit fdc83a8

Browse files
Merge remote-tracking branch 'upstream/main' into codex/pr-99134-live-canonical
2 parents a5a157b + 97ad0b7 commit fdc83a8

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

‎apps/android/app/src/main/java/ai/openclaw/app/ui/GatewayConfigResolver.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ internal fun composeGatewayManualUrl(
261261
}
262262
if (port !in 1..65535) return null
263263
val scheme = if (tls) "https" else "http"
264-
return "$scheme://$host:$port"
264+
return "$scheme://${ai.openclaw.app.gateway.formatGatewayAuthority(host, port)}"
265265
}
266266

267267
private fun parseJsonObject(input: String): JsonObject? = runCatching { gatewaySetupJson.parseToJsonElement(input).jsonObject }.getOrNull()

‎apps/android/app/src/test/java/ai/openclaw/app/ui/GatewayConfigResolverTest.kt‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,24 @@ class GatewayConfigResolverTest {
606606
assertNull(url)
607607
}
608608

609+
@Test
610+
fun composeGatewayManualUrl_bracketsIpv6ForEndpointParsing() {
611+
for (hostInput in listOf("::1", "[::1]")) {
612+
val url = composeGatewayManualUrl(hostInput, "18789", tls = false)
613+
614+
assertEquals("http://[::1]:18789", url)
615+
assertEquals(
616+
GatewayEndpointConfig(
617+
host = "::1",
618+
port = 18789,
619+
tls = false,
620+
displayUrl = "http://[::1]:18789",
621+
),
622+
parseGatewayEndpoint(url!!),
623+
)
624+
}
625+
}
626+
609627
@Test
610628
fun resolveGatewayConnectConfigManualAcceptsTailscaleHostWithoutPort() {
611629
val resolved =

0 commit comments

Comments
 (0)