mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
BUG FIX: Change the way of checking for empty array
The original condition : attachments !== [] always returns true, for empty array, as well as for array with elements.
This commit is contained in:
@@ -84,7 +84,7 @@ function createAttachmentDestinationFolder (destinationStoragePath, noteKey) {
|
|||||||
function migrateAttachments (markdownContent, storagePath, noteKey) {
|
function migrateAttachments (markdownContent, storagePath, noteKey) {
|
||||||
if (noteKey !== undefined && sander.existsSync(path.join(storagePath, 'images'))) {
|
if (noteKey !== undefined && sander.existsSync(path.join(storagePath, 'images'))) {
|
||||||
const attachments = getAttachmentsInMarkdownContent(markdownContent) || []
|
const attachments = getAttachmentsInMarkdownContent(markdownContent) || []
|
||||||
if (attachments !== []) {
|
if (attachments.length) {
|
||||||
createAttachmentDestinationFolder(storagePath, noteKey)
|
createAttachmentDestinationFolder(storagePath, noteKey)
|
||||||
}
|
}
|
||||||
for (const attachment of attachments) {
|
for (const attachment of attachments) {
|
||||||
|
|||||||
Reference in New Issue
Block a user