Unified · Split
| @@ -250,4 +250,22 @@ it.layer(testLayer)("checkOpenCodeProviderStatus with configured server URL", (i · 249 unmodified lines | |||
| 250 | ); | 250 | ); |
| 251 | }), | 251 | }), |
| 252 | ); | 252 | ); |
| 253 | |||
| 254 | it.effect("keeps IPv6 brackets in configured server diagnostics", () => | ||
| 255 | Effect.gen(function* () { | ||
| 256 | runtimeMock.state.inventoryError = new Error("fetch failed: connect ECONNREFUSED ::1:9999"); | ||
| 257 | const snapshot = yield* checkOpenCodeProviderStatus( | ||
| 258 | makeOpenCodeSettings({ | ||
| 259 | serverUrl: "http://[::1]:9999/private", | ||
| 260 | serverPassword: "secret-password", | ||
| 261 | }), | ||
| 262 | process.cwd(), | ||
| 263 | ); | ||
| 264 | |||
| 265 | NodeAssert.equal( | ||
| 266 | snapshot.message, | ||
| 267 | "Couldn't reach the configured OpenCode server at http://[::1]:9999. Check that the server is running and the URL is correct.", | ||
| 268 | ); | ||
| 269 | }), | ||
| 270 | ); | ||
| 253 | }); | 271 | }); |
| @@ -62,8 +62,7 @@ function normalizedErrorMessage(cause: unknown): string | undefined { · 61 unmodified lines | |||
| 62 | function openCodeServerDisplayTarget(input: string): string | undefined { | 62 | function openCodeServerDisplayTarget(input: string): string | undefined { |
| 63 | try { | 63 | try { |
| 64 | const url = new URL(input); | 64 | const url = new URL(input); |
| 65 | const port = url.port === "" ? "" : `:${url.port}`; | 65 | return `${url.protocol}//${url.host}`; |
| 66 | return `${url.protocol}//${url.hostname}${port}`; | ||
| 67 | } catch { | 66 | } catch { |
| 68 | return undefined; | 67 | return undefined; |
| 69 | } | 68 | } |