mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-25 08:02:15 +00:00
fix(desktop): support UNC picker containment
This commit is contained in:
parent
8ce4ddfb51
commit
1f48145b25
2 changed files with 5 additions and 1 deletions
|
|
@ -76,6 +76,10 @@ test("accepts mutations only from the active navigation", () => {
|
|||
test("preserves POSIX case while matching Windows drives case-insensitively", () => {
|
||||
expect(treePathWithin("/repo", "/Repo")).toBeFalse()
|
||||
expect(treePathWithin("C:/Repo", "c:/repo/src")).toBeTrue()
|
||||
expect(treePathWithin("//Server/Share/Repo", "//server/share/repo/src")).toBeTrue()
|
||||
expect(pickerMode("file", "//Server/Share/Repo").selection("//server/share/repo/src", "file.ts")).toBe(
|
||||
"src/file.ts",
|
||||
)
|
||||
expect(treePathWithin("/repo", "/repo/../tmp")).toBeFalse()
|
||||
expect(treePathWithin("/", "/src")).toBeTrue()
|
||||
expect(pickerMode("file", "C:/Repo").selection("c:/repo/src", "file.ts")).toBe("src/file.ts")
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ export function pickerRelativePath(base: string | undefined, path: string) {
|
|||
if (!base) return
|
||||
const rootPath = canonicalPickerPath(base)
|
||||
const targetPath = canonicalPickerPath(path)
|
||||
const insensitive = /^[A-Za-z]:\//.test(rootPath)
|
||||
const insensitive = /^[A-Za-z]:\//.test(rootPath) || rootPath.startsWith("//")
|
||||
const root = insensitive ? rootPath.toLowerCase() : rootPath
|
||||
const target = insensitive ? targetPath.toLowerCase() : targetPath
|
||||
if (target === root) return ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue