chore: refactoring and tests (#12629)

This commit is contained in:
Adam
2026-02-08 05:02:19 -06:00
committed by GitHub
parent 19b1222cd8
commit d1ebe0767c
16 changed files with 744 additions and 113 deletions
+9 -1
View File
@@ -2,7 +2,15 @@ export const deepLinkEvent = "opencode:deep-link"
export const parseDeepLink = (input: string) => {
if (!input.startsWith("opencode://")) return
const url = new URL(input)
if (typeof URL.canParse === "function" && !URL.canParse(input)) return
const url = (() => {
try {
return new URL(input)
} catch {
return undefined
}
})()
if (!url) return
if (url.hostname !== "open-project") return
const directory = url.searchParams.get("directory")
if (!directory) return