mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 00:04:49 +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
|
|
@ -5,6 +5,7 @@
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Bash output expanded hint now says "(ctrl+o to collapse)" ([#610](https://github.com/badlogic/pi-mono/pull/610) by [@tallshort](https://github.com/tallshort))
|
- Bash output expanded hint now says "(ctrl+o to collapse)" ([#610](https://github.com/badlogic/pi-mono/pull/610) by [@tallshort](https://github.com/tallshort))
|
||||||
|
- Fixed UTF-8 text corruption in remote bash execution (SSH, containers) by using streaming TextDecoder ([#608](https://github.com/badlogic/pi-mono/issues/608))
|
||||||
|
|
||||||
## [0.42.3] - 2026-01-10
|
## [0.42.3] - 2026-01-10
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -197,11 +197,13 @@ export async function executeBashWithOperations(
|
||||||
let tempFileStream: WriteStream | undefined;
|
let tempFileStream: WriteStream | undefined;
|
||||||
let totalBytes = 0;
|
let totalBytes = 0;
|
||||||
|
|
||||||
|
const decoder = new TextDecoder();
|
||||||
|
|
||||||
const onData = (data: Buffer) => {
|
const onData = (data: Buffer) => {
|
||||||
totalBytes += data.length;
|
totalBytes += data.length;
|
||||||
|
|
||||||
// Sanitize: strip ANSI, replace binary garbage, normalize newlines
|
// 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
|
// Start writing to temp file if exceeds threshold
|
||||||
if (totalBytes > DEFAULT_MAX_BYTES && !tempFilePath) {
|
if (totalBytes > DEFAULT_MAX_BYTES && !tempFilePath) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue