1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

Shorter code

This commit is contained in:
anasasilva
2018-12-20 17:16:24 +00:00
committed by Junyoung Choi
parent c474d972cb
commit fba9afd6f5

View File

@@ -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)
}