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

Function notePathWithinFolder

packages/app-core/src/lib/vault-layout.ts:791–802  ·  view source on GitHub ↗
(
  path: string,
  folder: NoteFolder,
  settings: VaultSettings | null | undefined
)

Source from the content-addressed store, hash-verified

789}
790
791export function notePathWithinFolder(
792 path: string,
793 folder: NoteFolder,
794 settings: VaultSettings | null | undefined
795): string {
796 if (folder === 'inbox' && isPrimaryNotesAtRoot(settings)) return path
797 const prefix = `${folder}/`
798 // Case-insensitive so a note under a capitalized on-disk system folder
799 // (e.g. `Inbox/`) lands in the same subpath as its sibling assets, which use
800 // the same lenient stripping. Mirrors `assetPathWithinFolder`. (#186)
801 return path.toLowerCase().startsWith(prefix) ? path.slice(prefix.length) : path
802}
803
804export function noteFolderSubpath(
805 note: Pick<NoteMeta, 'folder' | 'path'>,

Callers 1

noteFolderSubpathFunction · 0.85

Calls 1

isPrimaryNotesAtRootFunction · 0.85

Tested by

no test coverage detected