From 3f626c754828fd0703feef5fa0846a081ed992ff Mon Sep 17 00:00:00 2001 From: purocean Date: Thu, 9 Dec 2021 23:09:07 +0800 Subject: [PATCH] fix: fix link file name on windows --- src/renderer/plugins/editor-attachment.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/renderer/plugins/editor-attachment.ts b/src/renderer/plugins/editor-attachment.ts index b0fcd967..8ea38576 100644 --- a/src/renderer/plugins/editor-attachment.ts +++ b/src/renderer/plugins/editor-attachment.ts @@ -45,7 +45,8 @@ function addAttachment (asImage = false) { async function linkFile () { const { filePaths } = await api.choosePath({ properties: ['openFile', 'multiSelections'] }) const useList = filePaths.length > 1 - for (const path of filePaths) { + for (let path of filePaths) { + path = path.replaceAll('\\', '/') const filename = basename(path).replace(/[[\]]/g, '') insert(`${useList ? '- ' : ''}[${filename}](file://${encodeMarkdownLink(path)})\n`) }