diff --git a/src/main/menu/actions/file.js b/src/main/menu/actions/file.js index fd892c7e..634d0eb2 100644 --- a/src/main/menu/actions/file.js +++ b/src/main/menu/actions/file.js @@ -419,14 +419,17 @@ ipcMain.on('mt::format-link-click', (e, { data, dirname }) => { } let pathname = null - if (path.isAbsolute(href) && isMarkdownFile(href)) { + if (path.isAbsolute(href)) { pathname = href - } else if (!path.isAbsolute(href) && isMarkdownFile(path.join(dirname, href))) { + } else if (dirname && !path.isAbsolute(href)) { pathname = path.join(dirname, href) } - if (pathname) { + + if (pathname && isMarkdownFile(pathname)) { const win = BrowserWindow.fromWebContents(e.sender) return openFileOrFolder(win, pathname) + } else if (pathname) { + return shell.openPath(pathname) } })