The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 08:30 UTC
fix(ssh): read wildcard Includes in UTF-8 byte order (#38208)
Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Simone committed
Nov 17, 2026 at 17:35 UTC
733821285cf706cae221e745fbaaafd93a1b9207
2 files changed
+16
-1
packages/ssh/src/config.test.ts
+10
@@ -98,6 +98,15 @@ describe("ssh config", () => {
98
`Host unicode-${index}\n HostName unicode-${index}.example.com\n`,
99
);
100
}
101
+ for (const [file, hostname] of [
102
+ ["Z.conf", "first.example.com"],
103
+ ["🚀.conf", "second.example.com"],
104
+ ] as const) {
105
+ yield* fs.writeFileString(
106
+ path.join(sshDir, "config.d", file),
107
+ `Host ordered\n HostName ${hostname}\n`,
108
+ );
109
+ }
110
// OpenSSH's `?` matches one byte, so it never matches a multi-byte line separator.
111
yield* fs.writeFileString(
112
path.join(sshDir, "single.d", "team\u2028one.conf"),
@@ -142,6 +151,7 @@ describe("ssh config", () => {
151
["enabled", "enabled.example.com", "ssh-config"],
152
["known.example.com", "known.example.com", "known-hosts"],
153
["literal", "literal.example.com", "ssh-config"],
154
+ ["ordered", "first.example.com", "ssh-config"],
155
["real", "real.example.com", "ssh-config"],
156
["single-ascii", "single-ascii.example.com", "ssh-config"],
157
["svc\u2028x", "correct.example.com", "ssh-config"],
packages/ssh/src/config.ts
+6
-1
@@ -147,7 +147,12 @@ const expandGlob = Effect.fnUntraced(function* (
147
}
148
}
149
}
150
- return matchedPaths.toSorted();
150
+ // OpenSSH's glob sorts matches by UTF-8 bytes, not UTF-16 code units.
151
+ return matchedPaths.toSorted((left, right) => {
152
+ const leftBytes = globBytes(left);
153
+ const rightBytes = globBytes(right);
154
+ return leftBytes < rightBytes ? -1 : leftBytes > rightBytes ? 1 : 0;
155
+ });
156
});
157
158
type HostCondition = ReadonlyArray<string> | null;