Skip to content

Commit 8f84ac9

Browse files
committed
fix(gmail-setup): use truncateUtf16Safe for gmail setup output truncation
Replace raw UTF-16 slice in trimOutput with truncateUtf16Safe to prevent surrogate pair splitting in Gmail setup command output. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent 6ad8a77 commit 8f84ac9

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/hooks/gmail-setup-utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Gmail setup utilities write helper files and normalize Gmail setup settings.
22
import fs from "node:fs";
33
import path from "node:path";
4+
import { truncateUtf16Safe } from "@openclaw/normalization-core/utf16-slice";
45
import { formatErrorMessage } from "../infra/errors.js";
56
import { resolveExecutable } from "../infra/executable-path.js";
67
import { runCommandWithTimeout, type SpawnResult } from "../process/exec.js";
@@ -24,7 +25,7 @@ function trimOutput(value: string): string {
2425
if (trimmed.length <= MAX_OUTPUT_CHARS) {
2526
return trimmed;
2627
}
27-
return `${trimmed.slice(0, MAX_OUTPUT_CHARS)}…`;
28+
return `${truncateUtf16Safe(trimmed, MAX_OUTPUT_CHARS)}…`;
2829
}
2930

3031
function formatCommandResultInternal(

0 commit comments

Comments
 (0)