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

Function assetPathWithinFolder

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

Source from the content-addressed store, hash-verified

1233}
1234
1235export function assetPathWithinFolder(
1236 assetPath: string,
1237 folder: NoteFolder,
1238 settings: VaultSettings | null | undefined
1239): string {
1240 const normalized = assetPath.replace(/\\/g, '/').replace(/^\/+/, '')
1241 if (folder === 'inbox' && isPrimaryNotesAtRoot(settings)) return normalized
1242 const prefix = `${folder}/`
1243 // Strip the system-folder prefix case-insensitively so a capitalized on-disk
1244 // folder (e.g. `Inbox/`) lands in the same subpath tree as its notes. (#186)
1245 return normalized.toLowerCase().startsWith(prefix)
1246 ? normalized.slice(prefix.length)
1247 : normalized
1248}
1249
1250export function assetFolderSubpath(
1251 asset: Pick<AssetMeta, 'path'>,

Callers 1

assetFolderSubpathFunction · 0.85

Calls 1

isPrimaryNotesAtRootFunction · 0.85

Tested by

no test coverage detected