Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

desktop: directory picker submits home directory instead of typed path when adding a project

未关闭 适合新手
#59,589 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
electron, typescript
领域
desktop, frontend

调研方向

报告指出,DirectoryPickerDialog 是客户端入口点。阅读它的提交处理器,以及搜索输入、活动建议和当前选择的跟踪方式;然后通过输入绝对路径并在不选择建议的情况下选择文件夹,复现 Windows 流程。请求使用输入的路径,或者在路径得到确认前阻止提交,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Summary

In the "Open project" (Add project) directory picker, typing an absolute path (e.g. F:\Video-Edit) and clicking Select folder without first clicking the matching suggestion row submits the server's default location (C:\Users\<user>) instead of the typed path. The app then switches to the drive-root project C:/ (project id global), so "Add project" always lands on C:.

Environment

  • opencode version: 2.2.0 (OpenCode Desktop, bundled opencode-cli.exe, Electron 44.9.1 / Chrome 152)
  • OS: Windows 11 (Windows_NT 10.0.26200, win32 x64)
  • Terminal: Unavailable — reproduced in the desktop app (v2 web UI served by the background service), not a terminal
  • Shell: cmd.exe (system default)
  • Install/channel: desktop, channel latest
  • Active plugins: none found in ~/.config/opencode/opencode.jsonc (only MCP servers configured)

Reproduction

  1. Open the v2 web UI served by the desktop's background service (e.g. via an opencode pair link) and go to Home.
  2. Click Add project. The in-app "Open project" dialog opens; the footer/selection line shows the home directory (C:\Users\<user>).
  3. Type an absolute path on another drive, e.g. F:\Video-Edit, into the search input. Suggestions appear (F:\Video-Edit/, its subfolders, ...). Do not click a suggestion.
  4. Click Select folder.
  5. Watch the network tab: the app sends GET /api/location?location[directory]=C%3A%5CUsers%5C%3Cuser%3E (HTTP 200) — the typed path is ignored.
  6. Home switches to the project C: (worktree C:/, id global).

Verified working alternative: click the suggestion row F:\Video-Edit/ first (the footer line changes to F:\Video-Edit), then click Select folder — the request is then GET /api/location?location[directory]=F:\Video-Edit.

Note: pressing ArrowDown only sets the highlighted (active) suggestion; with an active-but-not-chosen suggestion, Select folder still submitted the home directory in my test.

Expected Behavior

Select folder should submit the typed path (or the active suggestion), i.e. resolve F:\Video-Edit — or refuse to submit while the input contains an unconfirmed path.

Actual Behavior

The dialog submits the server default location directory. The server resolves it to the drive-root project and the client switches selection to it:

  • Sent: GET /api/location?location[directory]=C:\Users\<user> → 200
  • Response: {"directory":"C:\\Users\\<user>","project":{"id":"global","directory":"C:\\","canonical":"C:\\"}}
  • Home selection becomes the C:/ project.

For comparison, the server itself resolves paths correctly — the bug is client-side state handling in DirectoryPickerDialog (submit uses the current selection, defaulting to the home root, instead of the input text / active suggestion):

GET /api/location?location[directory]=F:\Video-Edit
→ {"directory":"F:\\Video-Edit","project":{"id":"d72c10…","directory":"F:\\Video-Edit","canonical":"F:\\Video-Edit"}}

Additional Context

  • Frequency: 100% reproducible via the in-app (server-kind) picker on Windows.
  • Workaround: click the suggestion row first so the footer shows the intended path, then Select folder; or resolve the directory via the API/CLI directly.
  • Related annoyance: the global (C:/) project keeps reappearing in Home because default-location bootstraps (GET /api/location with no directory) touch it on every relevant page load.
  • The desktop-native flow (Electron openDirectory picker) was not separately verified in this session; this report covers the in-app DirectoryPickerDialog served at the v2 web UI.
主要语言
TypeScript
星标
221k
派生
29.6k
平均合并
4 小时 55 分钟
30 天内合并 PR
500

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。