mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
Error message when the image path is wrong
This commit is contained in:
committed by
Junyoung Choi
parent
65926fea73
commit
ea6e56842f
@@ -923,6 +923,8 @@ class NoteList extends React.Component {
|
||||
.then((newcontent) => {
|
||||
note.content = newcontent
|
||||
|
||||
dataApi.updateNote(storage.key, note.key, note)
|
||||
|
||||
dispatch({
|
||||
type: 'UPDATE_NOTE',
|
||||
note: note
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user