fix(coding-agent): resolved UTF-8 corruption in bash executor output (#433)

- Fixed UTF-8 text corruption in bash executor by replacing Buffer.toString() with streaming TextDecoder.
This commit is contained in:
Can Bölük 2026-01-04 03:15:50 +01:00 committed by GitHub
parent 7e2a99b485
commit 6ddfd1be13
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View file

@ -1,6 +1,9 @@
# Changelog
## [Unreleased]
### Fixed
- Fixed potential text decoding issues in bash executor by using streaming TextDecoder instead of Buffer.toString()
## [0.33.0] - 2026-01-04
@ -1298,4 +1301,4 @@ Initial public release.
- Git branch display in footer
- Message queueing during streaming responses
- OAuth integration for Gmail and Google Calendar access
- HTML export with syntax highlighting and collapsible sections
- HTML export with syntax highlighting and collapsible sections

View file

@ -97,11 +97,13 @@ export function executeBash(command: string, options?: BashExecutorOptions): Pro
options.signal.addEventListener("abort", abortHandler, { once: true });
}
const decoder = new TextDecoder();
const handleData = (data: Buffer) => {
totalBytes += data.length;
// Sanitize once at the source: strip ANSI, replace binary garbage, normalize newlines
const text = sanitizeBinaryOutput(stripAnsi(data.toString())).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) {