diff --git a/browser/main/lib/dataApi/attachmentManagement.js b/browser/main/lib/dataApi/attachmentManagement.js index b46c070d..5c310ecf 100644 --- a/browser/main/lib/dataApi/attachmentManagement.js +++ b/browser/main/lib/dataApi/attachmentManagement.js @@ -465,14 +465,10 @@ function importAttachments (markDownContent, filepath, storageKey, noteKey) { const groupIndex = 2 while (attachPath) { - attachmentPaths.push(attachPath[groupIndex]) - - if (path.isAbsolute(attachPath[groupIndex])) { - promiseArray.push(this.copyAttachment(attachPath[groupIndex], storageKey, noteKey)) - } else { - const fullPath = path.join(path.dirname(filepath), attachPath[groupIndex]) - promiseArray.push(this.copyAttachment(fullPath, storageKey, noteKey)) - } + let attachmentPath = attachPath[groupIndex] + attachmentPaths.push(attachmentPath) + attachmentPath = path.isAbsolute(attachmentPath) ? attachmentPath : path.join(path.dirname(filepath), attachmentPath) + promiseArray.push(this.copyAttachment(attachmentPath, storageKey, noteKey)) attachPath = nameRegex.exec(markDownContent) }