Repository navigation
[Bug] 从聊天引用点开文件时右侧预览失败:fs-error "… is not an absolute path"(Windows) #7099
NekoDD-wow
started this conversation in
General
Replies: 1 comment
|
同入口的文件夹变体(补充):聊天正文里的文件夹路径链接,点击后在右侧同样打不开——而且比文件的路径解析问题更深一层:是能力缺口,不只是解析失败。 复现:让 agent 在回复正文里引用一个工作区内的文件夹路径(渲染为链接)→ 点击 → 右侧侧边栏无反应/失败,且该文件夹的预览头部没有「在文件夹中显示」或「打开方式」控件(文件路径则有完整控件:默认图标 + 下拉 + reveal)。 代码层证据(0.1.7-rc.2 官方安装版 asar 抽取):
建议(分层):
环境:Windows 11 (build 26200);Desktop 0.1.7-rc.2(官方安装版)。 |
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.
环境
0.1.5-rc.2(已确认 master 与0.1.6-alpha.2同样存在)E:\py\output\aiouput\测试复现步骤
拖拽动图/1.png实际报错(客户端)
{"ok":false,"error":{"code":"fs-error", "message":"\"拖拽动图/1.png\" is not an absolute path"}}对照现象
同一个文件、同一个路径,从 Files 文件树点开是正常的。
也就是说:入口不同,结果不同。
根因分析
packages/client/ui-chat/src/client/apply.ts:fileAddressFor(sessionId, cwd, path)在cwd已知时会把工作区根目录剥掉,使地址里只保留工作区相对路径(这是
packages/util/workspace-path/README.md记录的既定设计)。服务端
dsh-api-workspace-files的locateFile()随后执行:但该相对路径没有被
workspaceRoot成功解析,最终抛出:而 Files 文件树入口产生的地址里是绝对路径(
cwd为空时fileAddressFor保留绝对路径),所以不受影响。
建议修复(任一)
apply.ts中改为fileAddressFor(sessionId, undefined, path),使地址保留绝对路径。
WorkspaceFiles.locateFile()正确使用workspaceFileScope.workspaceRoot解析工作区相对路径。临时绕过(已验证有效)
把打包产物
dsh-client-ui-chat/lib/client.js中,const cwd = ...?.cwd; const url = fileAddressFor(sessionId, cwd, path);改为
const url = fileAddressFor(sessionId, void 0, path);,刷新页面后恢复正常。相关讨论
/path被判定为绝对路径(同类路径作用域问题)All reactions