Replies: 1 comment
|
Landed your exact fix as a cherry-pick-ready branch:
Nice root-cause writeup — the "low byte happens to be 0x00 for any 0x100-multiple BMP code point" observation is exactly right. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
环境
@deepseek-ai/dsh-host-directory-picker-nativev0.1.0-rc.6复现步骤
D:\workspace\言语;预期
工作区 / 会话路径为
D:\workspace\言语。实际
路径从「言」处被截断:截断结果若恰好是存在的目录则静默落到父目录;否则报「无法打开文件夹」。
根因
lib/worker.cjs的readUtf16(第 21–25 行)只用低位字节判断 NUL 终止符:while (end + 1 < bytes.length && bytes[end] !== 0) end += 2;但 NUL 是
0x0000(两字节都为零)。「言」= U+8A00,低位字节恰为0x00,路径被提前截断(D:\workspace\言语被读成D:\workspace\,再经fs.realpath规整为父目录)。受影响的是任何码点为 0x100 整数倍的 BMP 字符(如 一 U+4E00、刀 U+5200、怀 U+6000、言 U+8A00)。修复建议
同时检查高低位字节:
while (end + 1 < bytes.length && (bytes[end] !== 0 || bytes[end + 1] !== 0)) end += 2;(本人已按此改动在本地临时修复并验证:选择含「言」的文件夹可正常建工作区。)
All reactions