Bug 403499

Summary: Opening URLs doesn't respect mimeapps.list and is buggy
Product: [Frameworks and Libraries] frameworks-kio Reporter: Martin <spleefer90>
Component: generalAssignee: David Faure <faure>
Status: RESOLVED NOT A BUG    
Severity: normal CC: a.samirh78, jgrulich, kdelibs-bugs, meven29, nate
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=100016
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Martin 2019-01-22 12:41:03 UTC
SUMMARY
KDE ignores mimeapps.list for launching URLs and can't get https://google.com opened by default.

STEPS TO REPRODUCE
1. ~/.config/mimeapps.list should contain
[Added Associations]
text/html=firefox.desktop;

2. Try opening https://google.com by clicking on it somewhere (I used Telegram)
3. Error: 'A folder named /home/c0rn3j/.cache/kioexec/krun/8344_0/ already exists.'

2. Try opening https://github.com/Lyrics/lyrics.github.io/issues/15 by clicking on it somewhere
3. It tries to open in Calibre. Why?

There's no way to make KDE just use the XDG defaults as far as I am aware, it just tries to open it in whatever app it finds suitable, and can't even open https://google.com 
https://i.imgur.com/7AAULL5.png

OBSERVED RESULT
Be able to open https://google.com with default settings
Have KDE respect mimeapps.list for default browser by default, at the very least have it as an option

EXPECTED RESULT
Can't open https://google.com - kio error
Can't get any URL to open in Firefox. It's either an error or Calibre.



SOFTWARE/OS VERSIONS
OS: Arch Linux
KDE Plasma Version: 5.14.5
KDE Frameworks Version: 5.54.0
Qt Version: 5.12.0

ADDITIONAL INFORMATION

The selected product is my best guess.
Comment 1 Jan Grulich 2019-01-22 13:23:58 UTC
Are we talking about opening URLs from Flatpak/Snap applications?
Comment 2 Martin 2019-01-22 15:12:40 UTC
No, I have Telegram installed as a normal system app through pacman.

It looks like KDE adds definitions into ~/.config/mimeapps.list when you select a hardcoded app to open URLs in, and does not remove when switching back to the default option, so reproducing this without deleting them manually is probably impossible.

With the definitions everything works just fine:

[Default Applications]
x-scheme-handler/http=firefox.desktop;
x-scheme-handler/https=firefox.desktop;
Comment 3 Jan Grulich 2019-01-22 15:20:46 UTC
In that case it's not xdg-desktop-portal-kde issue, but probably KRun?
Comment 4 Nate Graham 2019-02-06 04:56:17 UTC
Yep, it's in KRun. Here, have a patch: https://phabricator.kde.org/D18778
Comment 5 Ahmad Samir 2019-09-15 17:13:09 UTC
This looks like a configuration issue. Most distros set a web browser (you can check in the componentchooser kcm) to open http and https links.

Can you reproduce this issue with a new user account?
Comment 6 Méven Car 2020-01-21 13:29:12 UTC
text/html is the mimetype for html files

x-scheme-handler/http is the "meta" mimetype that designate an application to open an "http://" url.
So that is what you need to setup a browser.

Also when manually editing mimeapps.list rather than using kcmshell5 componentchooser, you will need to run kbuildsycoca5 and kdeinit5 to refresh the configuration cache (or close the session).

I think this is not really a bug.