fix(ui): refactor terminal output handling for UTF-8 and SSE consistency#19
Merged
fix(ui): refactor terminal output handling for UTF-8 and SSE consistency#19
Conversation
- Add sanitizeTerminalOutput() to centralize response filtering - Add decodeTTYOutputChunk() with persistent TextDecoder for stream-safe UTF-8 decoding - Route SSE fallback through same sanitization as WebSocket path - Reset decoder state on disconnect to prevent state leakage Fixes two defects in PR #18: 1. UTF-8 multibyte characters could be corrupted when split across WebSocket frames 2. SSE fallback bypassed response filtering, allowing garbage strings to leak No behavioral changes to terminal protocol or filtering rules. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
修复 PR #18 合并后遗留的两个前端缺陷:
Changes
sanitizeTerminalOutput()统一终端输出过滤逻辑decodeTTYOutputChunk()使用持久化 TextDecoder 实现流式 UTF-8 解码resetTTYOutputDecoder()在连接断开时重置解码器状态loadLog(),loadLogSince(), WebSocket handlers 使用统一的输出函数Testing
go test ./...通过gofmt -l .无格式化问题Related