Repository navigation
[6217] 假附件插件预检新增文件可访问性检查并修复非 ASCII 路径编码 - #4729
Merged
Merged
Conversation
PinkMagicFly
force-pushed
the
pigmagicfly/6217/attachment-precheck-encoding
branch
from
October 15, 2026 09:01
7fe17eb to
74d63a8
Compare
- fake-attachment-precheck 增 file-path 首参与可访问性规则(存在且为 普通文件、可读,g_ 层原语组合避开会抛 permission-error 的 file-exists?), 违规回 error 事件由 UI toast 原因并移除条目 - ingest 的 size 求值加同条件守卫:不可访问时 path-getsize 不再求值, 插件无响应致 UI 条目永久卡处理中的崩溃路径随之消除 - C++ 直灌 scheme 的 path/filename 由 from_qstring_utf8 改 from_qstring (herk 内部形态):connection_write 的 tree_herk_to_utf8 会把裸 UTF-8 逐字节二次映射打乱,中文路径到插件侧成乱码而预检误报「不存在」 - 附件错误 toast 改 utf8_to_qstring(cork_to_utf8(reason)) 确定性解码, 修复 to_qstring 启发式误走直通分支导致的实体乱码 - 测试:预检可访问性/不可读回归/线格式编码(chat-protocol-test 60 checks)、非 ASCII 文件名 herk 形态断言(qt_chat_controller_test)
PinkMagicFly
force-pushed
the
pigmagicfly/6217/attachment-precheck-encoding
branch
from
October 15, 2026 09:41
74d63a8 to
ff4c95b
Compare
PinkMagicFly
deleted the
pigmagicfly/6217/attachment-precheck-encoding
branch
October 15, 2026 11:57
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.
摘要
任务 [6217](任务文档:LiiiLabs/dev-agent#140):假附件插件本地(插件侧)预检新增文件可访问性检查,并修复随之暴露的非 ASCII 路径编码缺陷与错误 toast 实体乱码。
What
1. 预检新增可访问性规则(tm-attachment.scm)
fake-attachment-precheck首参增file-path,新增两条规则置于扩展名/数量/总大小之前:path-file?不通过 →「附件文件不存在: <文件名>」access 'R_OK不通过 →「附件文件不可读取: <文件名>」g_isfile/g_access),不经file-exists?——boot.scm 的file-exists?对存在但不可读的文件抛permission-errorfake-attachment-ingest的 size 求值加同条件守卫:path-getsize内部的file-exists?对不可读文件抛错,此前会使插件 REPL 无响应、UI 条目永久卡在处理中且发送栅栏不解禁(实测复现并修复)2. 非 ASCII 路径/文件名编码修复(qt_chat_controller.cpp)
onAttachRequested)与 %chat attachments 的 filename(attachment_items_to_scheme)由from_qstring_utf8(裸 UTF-8)改为from_qstring(herk 内部形态)connection_write(connection.cpp:266)对树先做tree_herk_to_utf8再交序列化器,裸 UTF-8 被逐字节查表二次映射(北E5 8C 97→å Ň Ů),插件收到乱码路径 →path-file?为假 → 预检误报「文件不存在」3. 附件错误 toast 实体乱码修复
onAttachmentError的 toast 由to_qstring(启发式)改为utf8_to_qstring (cork_to_utf8 (reason))to_qstring的 looks_utf8/looks_universal 启发式对「实体串 + 恰构成合法 UTF-8 的高位字节」混合会误走直通分支,<#9644>等实体原样上屏(与 FontSelectorBridge 等既有绕行惯例一致)Why
验证
xmake r chat-protocol-test:59 checks, 0 failed(含新增可访问性/不可读回归/线格式编码 test-chat-wire-encoding)xmake r qt_chat_controller_test:32 passed, 0 failed(含非 ASCII 文件名 herk 形态断言)-x直驱):utf8->herk中文路径 →attachment-ingest→ 插件子进程 ready → 抽取缓存落盘,文件名「北大(pkuthss é).pdf」完整保留(修复前同链路回「附件文件不存在」)🤖 Generated with Claude Code