A desktop coding agent with free access to frontier models.
TypeScript
fix: no url for share-less unc paths
ogsamratb0f7ad345b7c
diff --git a/apps/app/src/react-app/domains/session/sync/prompt-file-parts.ts b/apps/app/src/react-app/domains/session/sync/prompt-file-parts.tsindex 3bf91f28..5dfb38f5 100644--- a/apps/app/src/react-app/domains/session/sync/prompt-file-parts.ts+++ b/apps/app/src/react-app/domains/session/sync/prompt-file-parts.ts@@ -78,6 +78,8 @@ export function toFileUrl(path: string, windows = false) {const url = `file://${unc[1] ?? ""}${encodeFilePath(unc[2] ?? "")}`;return isUncHost(unc[1] ?? "") && parsedHost(url) === (unc[1] ?? "").toLowerCase() ? url : "";}+ // A share-less or malformed `//` path (`\\srv`, `\\?`) has no Windows file URL.+ if (windows && normalized.startsWith("//")) return "";return `file://${encodeFilePath(normalized)}`;}diff --git a/apps/app/tests/prompt-file-url.test.ts b/apps/app/tests/prompt-file-url.test.tsindex 6c24cf69..2d4de7b8 100644--- a/apps/app/tests/prompt-file-url.test.ts+++ b/apps/app/tests/prompt-file-url.test.ts@@ -78,6 +78,11 @@ describe("prompt file URLs", () => {expect(toFileUrl("//?/C:/x", true)).not.toStartWith("file://?");});+ test("share-less or malformed UNC paths have no Windows URL", () => {+ for (const path of ["//srv", "//localhost", "//?", "//", "///x"]) expect(toFileUrl(path, true)).toBe("");+ expect(promptFileUrl("\\\\srv", "C:\\Users\\omar\\code")).toBe("");+ });+test("UNC hosts the URL parser would rewrite or drop are not sent", () => {const root = "C:\\Users\\omar\\code";for (const host of ["localhost", "LOCALHOST", "nas.01", "192.168.1", "0x7f.1"]) {