1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

Error message when the image path is wrong

This commit is contained in:
anasasilva
2018-12-13 17:26:32 +00:00
committed by Junyoung Choi
parent 65926fea73
commit ea6e56842f
2 changed files with 23 additions and 6 deletions

View File

@@ -472,13 +472,28 @@ function importAttachments (markDownContent, filepath, storageKey, noteKey) {
attachName = nameRegex.exec(markDownContent)
}
Promise.all(promiseArray).then((fileNames) => {
for (let j = 0; j < fileNames.length; j++) {
const newPath = path.join(STORAGE_FOLDER_PLACEHOLDER, noteKey, fileNames[j])
markDownContent = markDownContent.replace(endPath[j], newPath)
}
let numResolvedPromises = 0
if (promiseArray.length === 0) {
resolve(markDownContent)
})
}
for (let j = 0; j < promiseArray.length; j++) {
promiseArray[j]
.then((fileName) => {
const newPath = path.join(STORAGE_FOLDER_PLACEHOLDER, noteKey, fileName)
markDownContent = markDownContent.replace(endPath[j], newPath)
})
.catch((e) => {
console.error('File does not exist in path: ' + endPath[j])
})
.finally(() => {
numResolvedPromises++
if (numResolvedPromises === promiseArray.length) {
resolve(markDownContent)
}
})
}
})
}