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

When storage or folder is removed, Detail components should render without error (#3168)

* optimize: when storage or folder is removed, Detail components should render without error, fix #2876

* optimize: Handle some scenarios where storage is not found, should not break the renderer

* optimize: NoteList should work without error when storage is not found
This commit is contained in:
hikerpig
2020-04-06 17:02:52 +08:00
committed by GitHub
parent 0d797ce8a8
commit 6ee92588b1
7 changed files with 69 additions and 24 deletions

View File

@@ -835,7 +835,15 @@ function getAttachmentsPathAndStatus(markdownContent, storageKey, noteKey) {
if (storageKey == null || noteKey == null || markdownContent == null) {
return null
}
const targetStorage = findStorage.findStorage(storageKey)
let targetStorage = null
try {
targetStorage = findStorage.findStorage(storageKey)
} catch (error) {
console.warn(`No stroage found for: ${storageKey}`)
}
if (!targetStorage) {
return null
}
const attachmentFolder = path.join(
targetStorage.path,
DESTINATION_FOLDER,