mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 22:03:45 +00:00
fix(coding-agent): UTF-8 corruption in remote bash execution
Applied streaming TextDecoder fix to executeBashWithOperations(), matching the fix in executeBash() from PR #433. Remote execution (SSH, containers) was still using Buffer.toString() which corrupts multi-byte UTF-8 sequences split across chunk boundaries. fixes #608
This commit is contained in:
parent
ec83d91473
commit
7293d7cb82
2 changed files with 4 additions and 1 deletions
|
|
@ -197,11 +197,13 @@ export async function executeBashWithOperations(
|
|||
let tempFileStream: WriteStream | undefined;
|
||||
let totalBytes = 0;
|
||||
|
||||
const decoder = new TextDecoder();
|
||||
|
||||
const onData = (data: Buffer) => {
|
||||
totalBytes += data.length;
|
||||
|
||||
// Sanitize: strip ANSI, replace binary garbage, normalize newlines
|
||||
const text = sanitizeBinaryOutput(stripAnsi(data.toString("utf-8"))).replace(/\r/g, "");
|
||||
const text = sanitizeBinaryOutput(stripAnsi(decoder.decode(data, { stream: true }))).replace(/\r/g, "");
|
||||
|
||||
// Start writing to temp file if exceeds threshold
|
||||
if (totalBytes > DEFAULT_MAX_BYTES && !tempFilePath) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue