fix: parse Coder authorities with Punycode (xn--) domain labels by EhabY · Pull Request #930 · coder/vscode-coder · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
6 changes: 6 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ export function parseRemoteAuthority(authority: string): AuthorityParts | null {
return null;
}

// Reassemble Punycode labels (xn--...) the split broke apart: when the
// prefix ends in ".xn", the cut landed inside an "xn--..." label.
while (parts.length >= 2 && parts[0].endsWith(".xn")) {
parts.splice(0, 2, `${parts[0]}--${parts[1]}`);
}

Comment thread
EhabY marked this conversation as resolved.
// It has the proper prefix, so this is probably a Coder host name.
// Validate the SSH host name. Including the prefix, we expect at least
// three parts, or four if including the agent.
Expand Down
224 changes: 150 additions & 74 deletions test/unit/util.test.ts
Loading