diff --git a/packages/app-desktop/gui/MainScreen/commands/openItem.ts b/packages/app-desktop/gui/MainScreen/commands/openItem.ts index 01cd56e22d..d4fd7f2b86 100644 --- a/packages/app-desktop/gui/MainScreen/commands/openItem.ts +++ b/packages/app-desktop/gui/MainScreen/commands/openItem.ts @@ -16,8 +16,13 @@ export const runtime = (): CommandRuntime => { if (!link) throw new Error('Link cannot be empty'); if (link.startsWith('joplin://') || link.startsWith(':/')) { - const { itemId, hash } = parseResourceUrl(link); - await openItemById(itemId, context.dispatch, hash); + const parsedUrl = parseResourceUrl(link); + if (parsedUrl) { + const { itemId, hash } = parsedUrl; + await openItemById(itemId, context.dispatch, hash); + } else { + void require('electron').shell.openExternal(link); + } } else if (urlProtocol(link)) { if (link.indexOf('file://') === 0) { // When using the file:// protocol, openPath doesn't work (does