fix(web): normalize Windows drive letter case for session path matching (#675)
On Windows, VS Code's uri.fsPath returns a lowercase drive letter (e.g. d:\MyProject) while the OpenCode server stores paths using process.cwd() which returns uppercase (D:\MyProject). This caused session queries to return empty results due to case-sensitive string comparison. Normalize drive letters to uppercase in both the VS Code extension (opencode.ts) and the shared UI client (client.ts) so that directory paths match regardless of the source casing. Fixes #670
This commit is contained in:
@@ -199,7 +199,11 @@ class OpencodeService {
|
||||
return null;
|
||||
}
|
||||
|
||||
const normalized = trimmed.replace(/\\/g, '/');
|
||||
// Normalize backslashes and uppercase the Windows drive letter so that
|
||||
// d:\MyProject and D:\MyProject resolve to the same canonical form.
|
||||
const normalized = trimmed
|
||||
.replace(/\\/g, '/')
|
||||
.replace(/^([a-z]):/, (_, letter: string) => letter.toUpperCase() + ':');
|
||||
const withoutTrailingSlash = normalized.length > 1 ? normalized.replace(/\/+$/, '') : normalized;
|
||||
|
||||
return withoutTrailingSlash || null;
|
||||
|
||||
Reference in New Issue
Block a user