Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't open joplin://x-callback-url link in MacOS desktop app #7354

Closed
d-volution opened this issue Nov 26, 2022 · 2 comments
Closed

Can't open joplin://x-callback-url link in MacOS desktop app #7354

d-volution opened this issue Nov 26, 2022 · 2 comments
Labels
bug It's a bug desktop All desktop platforms high High priority issues

Comments

@d-volution
Copy link

d-volution commented Nov 26, 2022

After clicking on a x-callback-url link the desktop app does not open the link, nor does it produce any ui visible change/reaction at all. No error message box, too. Opening normal http links works just fine.

It seems to me that the error comes from the fact that the regex in urlUtils.js line 3 doesn't match a x-callback-url.

Environment

Joplin version: 2.8.8
Platform: prod, darwin
OS specifics: macOS Big Sur (Version 11.6.3 on a MacBook Pro from 2014, Intel Core i5)

Steps to reproduce

  1. right click tag, -> copy external link to get tag url
  2. create a joplin://x-callback-url link in Markdown, like [link](joplin://x-callback-url/openTag?id=3c8bf0b1acb2423bac6242a94e9f3721)
  3. click on it in rendered view

Describe what you expected to happen

Obviously, clicking on the link should open it. But nothing happend. I've restarted Joplin and even tried to open the link from the Browser.

Dev-Tools Console output:

12:03:40: checkForUpdates: Starting...
12:03:40: checkForUpdates: Checking with options {"includePreReleases":false}
12:03:41: checkForUpdates: Current version: 2.8.8
12:03:41: checkForUpdates: Latest version: 2.8.8
12:03:41: checkForUpdates: Is Pre-release: false
12:03:43: checkForUpdates: Done.
Got ipc-message: joplin://x-callback-url/search?query=tag:api {resourceId: ''}
12:04:03: CommandService::execute: openItem joplin://x-callback-url/search?query=tag:api
Uncaught (in promise) TypeError: Cannot destructure property 'itemId' of 'parseResourceUrl(...)' as it is null.
    at openItem.ts:19
    at Generator.next (<anonymous>)
    at /Applications/Joplin.app/Contents/Resources/app.asar/gui/MainScreen/commands/openItem.js:8
    at new Promise (<anonymous>)
    at __awaiter (/Applications/Joplin.app/Contents/Resources/app.asar/gui/MainScreen/commands/openItem.js:4)
    at Object.execute (openItem.ts:15)
    at CommandService.<anonymous> (CommandService.ts:248)
    at Generator.next (<anonymous>)
    at /Applications/Joplin.app/Contents/Resources/app.asar/node_modules/@joplin/lib/services/CommandService.js:8
    at new Promise (<anonymous>)
12:04:03: RepositoryApi: findWorkingMirror: Could not connect to https://cdn.staticaly.com/gh/joplin/plugins/master: TypeError: Failed to fetch
Got ipc-message: joplin://x-callback-url/openTag?id=3c8bf0b1acb2423bac6242a94e9f3721 {resourceId: ''}
12:04:13: CommandService::execute: openItem joplin://x-callback-url/openTag?id=3c8bf0b1acb2423bac6242a94e9f3721
Uncaught (in promise) TypeError: Cannot destructure property 'itemId' of 'parseResourceUrl(...)' as it is null.
    at openItem.ts:19
    at Generator.next (<anonymous>)
    at /Applications/Joplin.app/Contents/Resources/app.asar/gui/MainScreen/commands/openItem.js:8
    at new Promise (<anonymous>)
    at __awaiter (/Applications/Joplin.app/Contents/Resources/app.asar/gui/MainScreen/commands/openItem.js:4)
    at Object.execute (openItem.ts:15)
    at CommandService.<anonymous> (CommandService.ts:248)
    at Generator.next (<anonymous>)
    at /Applications/Joplin.app/Contents/Resources/app.asar/node_modules/@joplin/lib/services/CommandService.js:8
    at new Promise (<anonymous>)

Logfile

2022-11-26 12:04:03: "CommandService::execute:", "openItem", "["joplin://x-callback-url/search?query=tag:api"]"
2022-11-26 12:04:03: RepositoryApi: "findWorkingMirror: Could not connect to https://cdn.staticaly.com/gh/joplin/plugins/master:", "TypeError: Failed to fetch
2022-11-26 12:04:13: "CommandService::execute:", "openItem", "["joplin://x-callback-url/openTag?id=3c8bf0b1acb2423bac6242a94e9f3721"]"

related issue:

#5168 Add support for callback URLs ...

@d-volution d-volution added the bug It's a bug label Nov 26, 2022
@laurent22 laurent22 added desktop All desktop platforms high High priority issues labels Nov 26, 2022
@roman-r-m
Copy link
Collaborator

roman-r-m commented Nov 26, 2022

The problem is that links starting with joplin:// interpreted differently when called from inside the app -- Joplin expects only ID after the protocol.
So it's working as designed, it's just the design turned out to be not very good.

@laurent22
Copy link
Owner

We should probably just pass the URL back to the system like a regular URL, since that's where the handler is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It's a bug desktop All desktop platforms high High priority issues
Projects
None yet
Development

No branches or pull requests

3 participants