Bug 483898 - Algorithm to select the default application for a mime-type is non conformant
Summary: Algorithm to select the default application for a mime-type is non conformant
Status: REPORTED
Alias: None
Product: frameworks-kservice
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: 6.0.0
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2024-03-18 13:13 UTC by Alessandro Astone
Modified: 2024-04-10 19:34 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Astone 2024-03-18 13:13:46 UTC
SUMMARY
The mime-apps specification at https://specifications.freedesktop.org/mime-apps-spec/latest/ar01s04.html states that all mimeapps.list files should be scanned for a valid [Default Applications] entry before falling back to [Added Associations].
In KDE instead, if you have a file at ~/.config/mimeapps.list with an invalid default application it will fall back the same file's [Added Associations] before looking at other files' [Default Applications].

The issue manifests when the distro changes the desktop file name of a browser you previously selected as default browser in systemsettings (which arguably shouldn't happen, but...)


STEPS TO REPRODUCE
1. Install a non-distro-default browser -- I'm going to use Chromium as an example
2. Backup ~/.config/mimeapps.list, if this is not a test machine
3. Create ~/.config/mimeapps.list with contents:
```
[Added Associations]
x-scheme-handler/http=bad-desktop-file.desktop;chromium-browser.desktop;
x-scheme-handler/https=bad-desktop-file.desktop;chromium-browser.desktop;
[Default Applications]
x-scheme-handler/http=bad-desktop-file.desktop;
x-scheme-handler/https=bad-desktop-file.desktop;
```
4. kbuildsycoca6
5. xdg-open http://foo

OBSERVED RESULT
https://foo opens in Chromium

EXPECTED RESULT
https://foo opens in the distro's default browser, as specified in some other XDG directory such as /usr/share/mimeapps.list

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Fedora KDE Rawhide
(available in About System)
KDE Plasma Version: 6.0.2
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2

ADDITIONAL INFORMATION
GNOME's implementation seems conformant
Comment 1 Nate Graham 2024-04-10 19:34:32 UTC
Harald and David, I recall that you two are ~~unlucky~~ fortunate enough to know something about the implementation here.