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

Function uriToFilePath

source code/tools/LSPTool/LSPTool.ts:540–552  ·  view source on GitHub ↗

* Extracts a file path from a file:// URI, decoding percent-encoded characters.

(uri: string)

Source from the content-addressed store, hash-verified

538 * Extracts a file path from a file:// URI, decoding percent-encoded characters.
539 */
540function uriToFilePath(uri: string): string {
541 let filePath = uri.replace(/^file:\/\//, '')
542 // On Windows, file:///C:/path becomes /C:/path — strip the leading slash
543 if (/^\/[A-Za-z]:/.test(filePath)) {
544 filePath = filePath.slice(1)
545 }
546 try {
547 filePath = decodeURIComponent(filePath)
548 } catch {
549 // Use un-decoded path if malformed
550 }
551 return filePath
552}
553
554/**
555 * Filters out locations whose file paths are gitignored.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected