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

Function cleanAssetFilename

apps/desktop/src/main/vault.ts:2880–2889  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

2878}
2879
2880function cleanAssetFilename(name: string): string {
2881 const raw = name.trim()
2882 if (/[\\/]/.test(raw)) throw new Error('Use only a file name.')
2883 const trimmed = path.basename(raw)
2884 if (!trimmed || trimmed === '.' || trimmed === '..') throw new Error('Asset name is required.')
2885 if (path.extname(trimmed).toLowerCase() === '.md') {
2886 throw new Error('Use note actions for markdown notes.')
2887 }
2888 return trimmed
2889}
2890
2891function cleanAssetTargetDir(root: string, targetDir: string): string {
2892 const normalized = normalizeVaultRelativePath(targetDir).replace(/^\/+|\/+$/g, '')

Callers 2

renameAssetFunction · 0.85
restoreDeletedAssetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected