MCPcopy
hub / github.com/claude-code-best/claude-code / validateUrl

Function validateUrl

src/utils/browser.ts:3–18  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

1import { execFileNoThrow } from './execFileNoThrow.js'
2
3function validateUrl(url: string): void {
4 let parsedUrl: URL
5
6 try {
7 parsedUrl = new URL(url)
8 } catch (_error) {
9 throw new Error(`Invalid URL format: ${url}`)
10 }
11
12 // Validate URL protocol for security
13 if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {
14 throw new Error(
15 `Invalid URL protocol: must use http:// or https://, got ${parsedUrl.protocol}`,
16 )
17 }
18}
19
20/**
21 * Open a file or folder path using the system's default handler.

Callers 1

openBrowserFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected