fix: fix link file name on windows

This commit is contained in:
purocean
2021-12-09 23:09:15 +08:00
parent 74255ec79f
commit 3f626c7548
+2 -1
View File
@@ -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`)
}