Skip to content

Commit cfd57ac

Browse files
maweibinclaude
andcommitted
fix(env): keep emoji / surrogate pairs intact during env value truncation
Use Array.from() to count full code points instead of UTF-16 code units, preventing lone surrogates in env var display output. Co-Authored-By: Claude Opus 4.8 <[email protected]>
1 parent 775ef96 commit cfd57ac

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/infra/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function formatEnvValue(value: string, redact?: boolean): string {
3636
if (singleLine.length <= 160) {
3737
return singleLine;
3838
}
39-
return `${singleLine.slice(0, 160)}…`;
39+
return `${Array.from(singleLine).slice(0, 160).join("")}…`;
4040
}
4141

4242
/** Logs an accepted env option once, with optional redaction for sensitive values. */

0 commit comments

Comments
 (0)