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

Function sanitizePath

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

Source from the content-addressed store, hash-verified

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