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

Function resolveSafe

apps/desktop/src/mcp/vault-ops.ts:330–337  ·  view source on GitHub ↗
(root: string, rel: string)

Source from the content-addressed store, hash-verified

328}
329
330function resolveSafe(root: string, rel: string): string {
331 const abs = path.resolve(root, rel)
332 const rootAbs = path.resolve(root)
333 if (abs !== rootAbs && !abs.startsWith(rootAbs + path.sep)) {
334 throw new Error(`Path escapes vault: ${rel}`)
335 }
336 return abs
337}
338
339function folderOf(root: string, abs: string): NoteFolder | null {
340 const rel = toPosix(path.relative(root, abs))

Callers 15

readNoteFunction · 0.70
writeNoteFunction · 0.70
createNoteFunction · 0.70
renameNoteFunction · 0.70
moveBetweenFoldersFunction · 0.70
moveNoteFunction · 0.70
duplicateNoteFunction · 0.70
deleteNoteFunction · 0.70
createFolderFunction · 0.70
renameFolderFunction · 0.70
deleteFolderFunction · 0.70
toggleTaskFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected