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

Function sanitizePath

source code/utils/cachePaths.ts:15–21  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

13// data (error logs, MCP logs) is not orphaned.
14const MAX_SANITIZED_LENGTH = 200
15function sanitizePath(name: string): string {
16 const sanitized = name.replace(/[^a-zA-Z0-9]/g, '-')
17 if (sanitized.length <= MAX_SANITIZED_LENGTH) {
18 return sanitized
19 }
20 return `${sanitized.slice(0, MAX_SANITIZED_LENGTH)}-${Math.abs(djb2Hash(name)).toString(36)}`
21}
22
23function getProjectDir(cwd: string): string {
24 return sanitizePath(cwd)

Callers 13

sessionStorage.tsFile · 0.70
gatherProjectCandidatesFunction · 0.70
getProjectDirFunction · 0.70
cachePaths.tsFile · 0.70
getRecordFilePathFunction · 0.70
getSessionRecordingPathsFunction · 0.70
getLocalAgentMemoryDirFunction · 0.50
getProjectTempDirFunction · 0.50
getBridgePointerPathFunction · 0.50

Calls 2

djb2HashFunction · 0.85
toStringMethod · 0.65

Tested by

no test coverage detected