mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-22 01:02:16 +00:00
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:
parent
7e2a99b485
commit
6ddfd1be13
2 changed files with 7 additions and 2 deletions
|
|
@ -1,6 +1,9 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed potential text decoding issues in bash executor by using streaming TextDecoder instead of Buffer.toString()
|
||||||
|
|
||||||
## [0.33.0] - 2026-01-04
|
## [0.33.0] - 2026-01-04
|
||||||
|
|
||||||
|
|
@ -1298,4 +1301,4 @@ Initial public release.
|
||||||
- Git branch display in footer
|
- Git branch display in footer
|
||||||
- Message queueing during streaming responses
|
- Message queueing during streaming responses
|
||||||
- OAuth integration for Gmail and Google Calendar access
|
- OAuth integration for Gmail and Google Calendar access
|
||||||
- HTML export with syntax highlighting and collapsible sections
|
- HTML export with syntax highlighting and collapsible sections
|
||||||
|
|
@ -97,11 +97,13 @@ export function executeBash(command: string, options?: BashExecutorOptions): Pro
|
||||||
options.signal.addEventListener("abort", abortHandler, { once: true });
|
options.signal.addEventListener("abort", abortHandler, { once: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const decoder = new TextDecoder();
|
||||||
|
|
||||||
const handleData = (data: Buffer) => {
|
const handleData = (data: Buffer) => {
|
||||||
totalBytes += data.length;
|
totalBytes += data.length;
|
||||||
|
|
||||||
// Sanitize once at the source: strip ANSI, replace binary garbage, normalize newlines
|
// 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
|
// 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