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

custom URL issues #3219

Closed
Niko-CZ opened this issue Jun 3, 2019 · 10 comments
Closed

custom URL issues #3219

Niko-CZ opened this issue Jun 3, 2019 · 10 comments
Labels

Comments

@Niko-CZ
Copy link

Niko-CZ commented Jun 3, 2019

Expected Behavior

  • "Open URL" for [ff://http://xxx.com/wp-admin] shall start custom URL handler and open Firefox browser page.
  • "Open URL" for [chrome://google.com] shall start custom URL handler and open Chrome browser page.

Current Behavior

  • "Open URL" for [ff://http://{NOTES}/wp-admin], where {NOTES} is equal to [xxx.com]:

image

1) special symbol colons disappeared (maybe was not encoded) 
2) reference was not transferred to value
  • "Open URL" for [chrome://google.com]
    has no reaction at all.
  • "Open URL" for [chrome:////google.com]
    is starting custom URL handler and opens Chrome browser page.

From Mac OS terminal following custom URLs are opened in correct way:
- [open ff://http://xxx.com/wp-admin]
- [open chrome://google.com]
They are also opened in correct way from MacPass 0.7.3 after double click on URL (same database file).

OS: macOS Mojave 10.14.5
Enabled extensions: None

@Niko-CZ Niko-CZ added the bug label Jun 3, 2019
@droidmonkey
Copy link
Member

ff://http:// is not a valid URL. If you want to launch specifically Firefox use the cmd:// syntax: cmd://firefox http://{NOTES}/wp-admin

@Niko-CZ
Copy link
Author

Niko-CZ commented Jun 4, 2019

Well [ff] here is just for example. It is not possible to open any other custom URL.
I recall that one of closed bugs/features in 2.4.2 was dedicated to OS handling of URLs
(Fix opening url's with non-http schemes #3153). Description from fix "...Let the OS handle how to open the url...". In this case obviously handling was not handover-ed to OS, which is able to run "open ff://http://xxx.com/wp-admin" and "open chrome://google.com".
Is it possible to simplify custom URL handling with following logic:
analyze URL string <URL>://<command>
If <URL> is custom (not cmd://) --> run OS command open <URL>://"<command>"
?
There is another possibility how to build custom workflow of URL handling in form of enhancement. It is implemented in Keepass 2.x and called "URL override". For the case above it would be like that:
URL to override: ff
Command: cmd://firefox {URL:RMVSCM}
So each user of shared kdb could customize execution scheme independently of OS platform.
https://keepass.info/help/base/autourl.html#override

@SohamG
Copy link
Contributor

SohamG commented Jun 5, 2019

I honestly didn't even know about ff:// and chrome:// when I started the PR

I did some investigating (Ubuntu 18.04 with backports):

  • xdg-open ff://https://youtube.com opens default browser (firefox) with the string ff://https://youtube.com in the default search engine (here ff:// can be any random string, same result)
  • xdg-open chrome://https://youtube.com started a new instance of default browser, at the home page
  • I did some digging into the .desktop files provided by both
    • firefox.desktop is set to handle chrome:// urls, but not ff://
    • google-chrome.desktop is set to handle neither chrome:// not ff://
    • "set to handle" means using x-scheme-handler/<scheme> in the MimeTypes= field in the desktop file
  • I had the EXACT same results attempting to open ff:// and chrome:// through keepassxc.

All this leads me to believe this has something to do with Qt-MacOS interfacing, as on my system my OS is handling the urls. Further emphasized by ff:// not being handled by either browser. I don't know really where to go from here

@Niko-CZ
Copy link
Author

Niko-CZ commented Jun 5, 2019

Well... Dont know how to help with it. Maybe only to reference MacPass 0.7.3 which is able to open URLs in the same way OS does.
https://github.com/MacPass/MacPass

@Niko-CZ
Copy link
Author

Niko-CZ commented Jun 5, 2019

Also tested with standard URL "ssh".
For macOS 10.14.5 it looks like slashes shall be escaped (and most probably other special symbols) in Qt call.

  • ssh://<ip> - do not work
  • ssh:////<ip> - works

@SohamG
Copy link
Contributor

SohamG commented Jun 5, 2019

Further evidence of it being a Qt --> Mac interface issue, I had explicitly tested ssh:// (and steam://) before opening the PR. Makes me wonder if its an upstream bug/quirk, based on no mention of any of this in the QUrl class docs and QDesktopServices class

About MacPass, it only targets macOS (and is written in objective c) where as keepassxc targets (through Qt) mac windows and linux, so I don't think it can be used as reference

@droidmonkey
Copy link
Member

Interesting, I'll run this through the debugger on mac later.

@SohamG
Copy link
Contributor

SohamG commented Jun 15, 2019

Wonder if #3264 fixes this

@Niko-CZ
Copy link
Author

Niko-CZ commented Oct 10, 2019

How do you create custom URL handlers in MacOS?
simple way: 1) create apple script which will handle custom URLs. 2) generate application from it 3) Put all URLs which you want to associate with it in Info.plist
*Btw you may find all you need on 1st results Google page for "mac os custom url".

@khzied
Copy link

khzied commented Jul 14, 2020

Hello,
Any news I cannot open url with another browser than the default one.
MacOS 10.15
KeePassXC : 2.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants