Skip to content

Commit 698ba22

Browse files
fix(web): IPv6 SSH suggestions on a port stay distinct from bare addresses
Encode a ported suggestion as OpenSSH's bracketed [host]:port so fd7a::1 on 2222 no longer collides with the bare address fd7a::1:2222. AI-assisted; verified with the tests and tools listed above.
1 parent f859e4f commit 698ba22

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎apps/web/src/components/settings/AddEnvironmentDialog.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ import {
6666
} from "./ConnectionsSettings.logic";
6767

6868
const EMPTY_DISCOVERED_SSH_HOSTS: ReadonlyArray<DesktopDiscoveredSshHost> = [];
69-
// known_hosts can list one host on several ports; the port keeps each suggestion distinct.
69+
// known_hosts can list one host on several ports. Its own bracketed form keeps an IPv6
70+
// host's port separate from the address; no portless known_hosts entry has that form.
7071
const sshHostSuggestionValue = (target: DesktopDiscoveredSshHost) =>
71-
target.port === null ? target.alias : `${target.alias}:${target.port}`;
72+
target.port === null ? target.alias : `[${target.alias}]:${target.port}`;
7273

7374
export function AddEnvironmentDialog({
7475
open,

0 commit comments

Comments
 (0)