fix(client): parse a port-less bracketed IPv6 host in parseJoinCode - #5178
fix(client): parse a port-less bracketed IPv6 host in parseJoinCode#5178jeffrey701 wants to merge 1 commit into
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
parseJoinCode splits host:port on the LAST colon. For a bracketed IPv6 literal with no port (e.g. `[::1]`), that colon is inside the address, so the host became `[:` and the join code resolved to a malformed `wss://[::1/ws`. Treat a host ending in `]` as bracketed-with-no-port and skip the split; a bracketed host that does carry a port (`[::1]:9000`) still splits correctly.
9c7738d to
bfc031a
Compare
|
Deferred by maintainer intake policy — not ignored. This current head ( A maintainer must explicitly take this PR or add a local frontend-review exception before it can receive substantive review. The defer label is a routing marker only, not a verdict on the change. |
1 similar comment
|
Deferred by maintainer intake policy — not ignored. This current head ( A maintainer must explicitly take this PR or add a local frontend-review exception before it can receive substantive review. The defer label is a routing marker only, not a verdict on the change. |
Problem
parseJoinCode(client/src/services/serverDetection.ts) splitshost:porton the last colon:For a bracketed IPv6 literal with no port (
[::1]), that last colon is inside the address, sohostbecomes"[:"and the join codeABC123@[::1]resolves to a malformed, unconnectablewss://[::1/ws.Fix
A bracketed host with no port ends in
], so add!hostPort.endsWith("]")to thehasPortcheck. A bracketed host that does carry a port ([::1]:9000) does not end in], so it still splits correctly.Test
client/src/services/__tests__/serverDetection.test.ts—[::1]resolves towss://[::1]/ws, and[::1]:9000still splits towss://[::1]:9000/ws.