MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / validateUrl

Function validateUrl

source code/utils/browser.ts:5–20  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

3import { execFileNoThrow } from './execFileNoThrow.js'
4
5function validateUrl(url: string): void {
6 let parsedUrl: URL
7
8 try {
9 parsedUrl = new URL(url)
10 } catch (_error) {
11 throw new Error(`Invalid URL format: ${url}`)
12 }
13
14 // Validate URL protocol for security
15 if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {
16 throw new Error(
17 `Invalid URL protocol: must use http:// or https://, got ${parsedUrl.protocol}`,
18 )
19 }
20}
21
22/**
23 * 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