fix(sonar): use replaceAll string instead of control-char regex (javascript:S6324)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
mARTin-B78 2026-10-06 03:51:04 +02:00
parent 1d65a4df7c
commit 11ab1ff677

View File

@ -83,7 +83,7 @@ async function mergeWavBlobs(blobs, gapMs = 0) {
function splitTextIntoChunks(text, maxLen = 800) {
const abbrev = /\b(Mr|Mrs|Ms|Dr|Prof|Sr|Jr|vs|etc|e\.g|i\.e)\.\s/g;
const safe = text.replace(abbrev, m => m.replace('.', '\x00'));
const restore = s => s.replace(/\x00/g, '.');
const restore = s => s.replaceAll('\x00', '.');
// Gather segments from each line: sentences first, then any remaining line text.
// This ensures newline-delimited text (e.g. German bullet lists) gets split too.