1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-12 17:26:17 +00:00

fix exporting storage's notes into their own folders

This commit is contained in:
Baptiste Augrain
2020-06-12 17:36:46 +02:00
parent aa8b589569
commit f4259bb4d0

View File

@@ -45,6 +45,8 @@ function exportStorage(storageKey, fileType, exportDir, config) {
const contentFormatter = getContentFormatter(storage, fileType, config) const contentFormatter = getContentFormatter(storage, fileType, config)
const folderNamesMapping = {} const folderNamesMapping = {}
const deduplicators = {}
storage.folders.forEach(folder => { storage.folders.forEach(folder => {
const folderExportedDir = path.join( const folderExportedDir = path.join(
exportDir, exportDir,
@@ -57,17 +59,17 @@ function exportStorage(storageKey, fileType, exportDir, config) {
try { try {
fs.mkdirSync(folderExportedDir) fs.mkdirSync(folderExportedDir)
} catch (e) {} } catch (e) {}
})
const deduplicator = {} deduplicators[folder.key] = {}
})
return Promise.all( return Promise.all(
notes.map(note => { notes.map(note => {
const targetPath = getFilename( const targetPath = getFilename(
note, note,
fileType, fileType,
exportDir, folderNamesMapping[note.folder],
deduplicator deduplicators[note.folder]
) )
return exportNote(storage.key, note, targetPath, contentFormatter) return exportNote(storage.key, note, targetPath, contentFormatter)