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

Function sanitizePath

source code/utils/sessionStoragePortable.ts:313–321  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

311 * @returns A safe name (e.g., '-Users-foo-my-project' or 'plugin-name-server')
312 */
313export function sanitizePath(name: string): string {
314 const sanitized = name.replace(/[^a-zA-Z0-9]/g, '-')
315 if (sanitized.length <= MAX_SANITIZED_LENGTH) {
316 return sanitized
317 }
318 const hash =
319 typeof Bun !== 'undefined' ? Bun.hash(name).toString(36) : simpleHash(name)
320 return `${sanitized.slice(0, MAX_SANITIZED_LENGTH)}-${hash}`
321}
322
323// ---------------------------------------------------------------------------
324// Project directory discovery (shared by listSessions & getSessionMessages)

Callers 2

getProjectDirFunction · 0.70
findProjectDirFunction · 0.70

Calls 2

simpleHashFunction · 0.85
toStringMethod · 0.65

Tested by

no test coverage detected