Skip to content

Commit 0fa3981

Browse files
committed
fix(memory-lancedb): use truncateUtf16Safe for sanitize text truncation
1 parent 1fdb0e7 commit 0fa3981

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

extensions/memory-lancedb/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ export function sanitizeForMemoryCapture(text: string): string {
11681168

11691169
// Pre-truncate to cap regex work on very large inputs (ReDoS mitigation)
11701170
const MAX_SANITIZE_CHARS = 10_000;
1171-
let cleaned = text.length > MAX_SANITIZE_CHARS ? text.slice(0, MAX_SANITIZE_CHARS) : text;
1171+
let cleaned = text.length > MAX_SANITIZE_CHARS ? truncateUtf16Safe(text, MAX_SANITIZE_CHARS) : text;
11721172
let strippedInjectedContext = false;
11731173

11741174
// Strip leading timestamp prefix

0 commit comments

Comments
 (0)