MCPcopy
hub / github.com/OpenCoworkAI/open-codesign / normalizeDesignFilePath

Function normalizeDesignFilePath

apps/desktop/src/main/snapshots-db.ts:413–424  ·  view source on GitHub ↗
(raw: string)

Source from the content-addressed store, hash-verified

411}
412
413export function normalizeDesignFilePath(raw: string): string {
414 const s = raw.trim();
415 if (s.length === 0) throw new Error('path must not be empty');
416 if (s.startsWith('/') || /^[a-zA-Z]:[\\/]/.test(s)) {
417 throw new Error(`path must be relative: ${raw}`);
418 }
419 const parts = s.replaceAll('\\', '/').split('/');
420 for (const part of parts) {
421 if (part === '..' || part === '') throw new Error(`invalid path segment in ${raw}`);
422 }
423 return parts.join('/');
424}
425
426export function listDesignFiles(_db: Database, _designId: string): DesignFile[] {
427 const design = getDesign(_db, _designId);

Callers 8

registerWorkspaceIpcFunction · 0.90
persistMutationFunction · 0.90
syncWorkspaceTextFileFunction · 0.90
walkFunction · 0.85
viewDesignFileFunction · 0.85
upsertDesignFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected