mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 10:16:44 +00:00
fix(scripts): preserve emoji in dev tooling previews (#109469)
Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
co-authored by
Peter Steinberger
parent
3b1667e286
commit
2e3b4ab586
@@ -1,5 +1,6 @@
|
||||
// Dev Tooling Safety script supports OpenClaw repository automation.
|
||||
import path from "node:path";
|
||||
import { truncateUtf16Safe } from "@openclaw/normalization-core/utf16-slice";
|
||||
import { redactSensitiveText } from "../../src/logging/redact.js";
|
||||
|
||||
const REDACT_OPTIONS = { mode: "tools" } as const;
|
||||
@@ -13,7 +14,7 @@ export function previewForDevToolLog(value: string, maxChars = 400): string {
|
||||
if (redacted.length <= maxChars) {
|
||||
return redacted;
|
||||
}
|
||||
return `${redacted.slice(0, Math.max(0, maxChars - 3))}...`;
|
||||
return `${truncateUtf16Safe(redacted, Math.max(0, maxChars - 3))}...`;
|
||||
}
|
||||
|
||||
export function maskIdentifier(value: string | undefined, keepStart = 6, keepEnd = 4): string {
|
||||
|
||||
@@ -219,6 +219,10 @@ describe("dev tooling safety helpers", () => {
|
||||
);
|
||||
expect(maskIdentifier("session-key-abcdef123456")).toBe("sessio...3456");
|
||||
});
|
||||
|
||||
it("does not split boundary emoji in script log previews", () => {
|
||||
expect(previewForDevToolLog("123456😀tail", 10)).toBe("123456...");
|
||||
});
|
||||
});
|
||||
|
||||
describe("script-specific dev tooling hardening", () => {
|
||||
|
||||
Reference in New Issue
Block a user