MCPcopy Index your code
hub / github.com/codeaashu/claude-code / sanitizePath

Function sanitizePath

src/utils/sessionStoragePortable.ts:311–319  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

309 * @returns A safe name (e.g., '-Users-foo-my-project' or 'plugin-name-server')
310 */
311export function sanitizePath(name: string): string {
312 const sanitized = name.replace(/[^a-zA-Z0-9]/g, '-')
313 if (sanitized.length <= MAX_SANITIZED_LENGTH) {
314 return sanitized
315 }
316 const hash =
317 typeof Bun !== 'undefined' ? Bun.hash(name).toString(36) : simpleHash(name)
318 return `${sanitized.slice(0, MAX_SANITIZED_LENGTH)}-${hash}`
319}
320
321// ---------------------------------------------------------------------------
322// 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