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