fix: 修复 WSL 会话 Linux 路径解析 (#399)

This commit is contained in:
Kunping Wang
2026-09-02 23:20:17 +08:00
committed by Menghuan1918
parent dde0923980
commit 180b16de1b
4 changed files with 94 additions and 5 deletions
+2 -1
View File
@@ -30,6 +30,7 @@ import {
type SidebarPrefs,
} from './config.ts'
import { parentOf, requireAbsolute, listDirectory, rootLabel } from './fs-tree.ts'
import { resolveSessionPath } from './session-path.ts'
import { writeWorkspaceUpload } from './fs-operations.ts'
import { ensureWorkspacePath, ensureWorkspaceWritePath } from './path-security.ts'
import { searchFiles } from './fs-search.ts'
@@ -156,7 +157,7 @@ function selectedRepoOf(payload: unknown): string | undefined {
* cwd when the root cannot be resolved, e.g. a bare directory).
*/
async function resolveGitPath(cwd: string, raw: string, selected?: string): Promise<string> {
if (isAbsolute(raw)) return requireAbsolute(raw)
if (isAbsolute(raw)) return requireAbsolute(resolveSessionPath(cwd, raw))
// Prefer the session-relative interpretation when it names an existing
// path. Git status reports repository-root-relative names, but the sidebar
// security boundary is the session workspace; this preference keeps files