fix(provider): preserve IPv6 display targets
Co-authored-by: codex <[email protected]>
This commit is contained in:
1 parent
65ff046bdf
commit
6524964785
2 files changed
+19
-2
No files matched your search
@@ -250,4 +250,22 @@ it.layer(testLayer)("checkOpenCodeProviderStatus with configured server URL", (i
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("keeps IPv6 brackets in configured server diagnostics", () =>
|
||||
Effect.gen(function* () {
|
||||
runtimeMock.state.inventoryError = new Error("fetch failed: connect ECONNREFUSED ::1:9999");
|
||||
const snapshot = yield* checkOpenCodeProviderStatus(
|
||||
makeOpenCodeSettings({
|
||||
serverUrl: "http://[::1]:9999/private",
|
||||
serverPassword: "secret-password",
|
||||
}),
|
||||
process.cwd(),
|
||||
);
|
||||
|
||||
NodeAssert.equal(
|
||||
snapshot.message,
|
||||
"Couldn't reach the configured OpenCode server at http://[::1]:9999. Check that the server is running and the URL is correct.",
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
@@ -62,8 +62,7 @@ function normalizedErrorMessage(cause: unknown): string | undefined {
|
||||
function openCodeServerDisplayTarget(input: string): string | undefined {
|
||||
try {
|
||||
const url = new URL(input);
|
||||
const port = url.port === "" ? "" : `:${url.port}`;
|
||||
return `${url.protocol}//${url.hostname}${port}`;
|
||||
return `${url.protocol}//${url.host}`;
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user