( assetPath: string, folder: NoteFolder, settings: VaultSettings | null | undefined )
| 1233 | } |
| 1234 | |
| 1235 | export 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 | |
| 1250 | export function assetFolderSubpath( |
| 1251 | asset: Pick<AssetMeta, 'path'>, |
no test coverage detected