MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / resolveSafe

Function resolveSafe

apps/desktop/src/main/vault.ts:2634–2641  ·  view source on GitHub ↗
(root: string, rel: string)

Source from the content-addressed store, hash-verified

2632}
2633
2634function resolveSafe(root: string, rel: string): string {
2635 const abs = path.resolve(root, rel)
2636 const rootAbs = path.resolve(root)
2637 if (abs !== rootAbs && !abs.startsWith(rootAbs + path.sep)) {
2638 throw new Error(`Path escapes vault: ${rel}`)
2639 }
2640 return abs
2641}
2642
2643export async function readNote(root: string, rel: string): Promise<NoteContent> {
2644 const abs = resolveSafe(root, rel)

Callers 15

noteCommentsPathFunction · 0.70
databaseDataPathFunction · 0.70
databaseSidecarPathFunction · 0.70
moveIntoAssetsFunction · 0.70
walkFunction · 0.70
migrateOneLegacyDatabaseFunction · 0.70
snapshotNoteMetaCacheFunction · 0.70
invalidateNoteMetaCacheFunction · 0.70
hydrateSearchOffsetsFunction · 0.70
readNoteFunction · 0.70
writeNoteFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected