From 4a3bcaba0657dd17e4494ebb94122de85e15c617 Mon Sep 17 00:00:00 2001 From: Maciek Date: Sat, 28 Jul 2018 22:25:10 +0200 Subject: [PATCH] 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. --- browser/main/lib/dataApi/attachmentManagement.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/main/lib/dataApi/attachmentManagement.js b/browser/main/lib/dataApi/attachmentManagement.js index 46560a1a..d1e0ab62 100644 --- a/browser/main/lib/dataApi/attachmentManagement.js +++ b/browser/main/lib/dataApi/attachmentManagement.js @@ -84,7 +84,7 @@ function createAttachmentDestinationFolder (destinationStoragePath, noteKey) { function migrateAttachments (markdownContent, storagePath, noteKey) { if (noteKey !== undefined && sander.existsSync(path.join(storagePath, 'images'))) { const attachments = getAttachmentsInMarkdownContent(markdownContent) || [] - if (attachments !== []) { + if (attachments.length) { createAttachmentDestinationFolder(storagePath, noteKey) } for (const attachment of attachments) {