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

BUG FIX: snippet notes are not displaying in markdown #2088

Fix for issue https://github.com/BoostIo/Boostnote/issues/2088.
In specific situation, when all below conditions are met :
- one of the snippets notes tabs is a Markdown tab,
- the migrateAttachments code is called on a snippet note,
- historical attachments location '/images' exists in snippet storage
  folder

Following exception is being thrown :
path.js:28 Uncaught TypeError: Path must be a string. Received undefined
The exception is a result of an undefined noteKey variable
(which is defined only for Markdown notes).
The solution is to skip migration of attachments for notes without
noteKey (which wouldn't be possible anyway, since noteKey is a
necessary for creating folder for attachments).
This commit is contained in:
Maciek
2018-07-28 22:23:14 +02:00
parent 7330cdaf1c
commit 1d1ab65edd

View File

@@ -82,7 +82,7 @@ function createAttachmentDestinationFolder (destinationStoragePath, noteKey) {
* @param noteKey Key of the current note
*/
function migrateAttachments (markdownContent, storagePath, noteKey) {
if (sander.existsSync(path.join(storagePath, 'images'))) {
if (noteKey !== undefined && sander.existsSync(path.join(storagePath, 'images'))) {
const attachments = getAttachmentsInMarkdownContent(markdownContent) || []
if (attachments !== []) {
createAttachmentDestinationFolder(storagePath, noteKey)