Bug 481473 - File associations do not de-duplicate applications using X-KDE-AliasFor, resulting in some applications being shown twice or more
Summary: File associations do not de-duplicate applications using X-KDE-AliasFor, resu...
Status: ASSIGNED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.93.0
Platform: Arch Linux Linux
: NOR minor
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2024-02-17 16:39 UTC by Adam Fontenot
Modified: 2024-03-04 20:03 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Fontenot 2024-02-17 16:39:50 UTC
SUMMARY

For reasons unknown to me, some KDE applications (e.g. Okular) have multiple .desktop files for different filetypes. Okular, for example, has `okularApplication_md.desktop` and `okularApplication_txt.desktop`, along with many others.

This causes an issue in that all Markdown (.md) files are also plain text (.txt) files. So if you try to open a Markdown file, you'll see Okular twice in the list of possible applications.

Unless applications are supposed to *never* have multiple .desktop entries, KDE needs to deduplicate these. It appears that the way KDE applications are indicating the use of multiple .desktop entries is via the use of the `X-KDE-AliasFor` line, e.g.

    X-KDE-AliasFor=org.kde.okular.desktop

Similarly, if a user assigns an application to a file type (e.g. I have Okular set to open PDF files), and the application also inherits the file type via a different .desktop file (e.g. okularApplication_pdf.desktop), the application will be shown twice for the file.

KDE should most likely only add the first entry that appears in its search with a specific alias to the applications that can open a given file type.

STEPS TO REPRODUCE
1. Make a simple Markdown (.md) file.
2. Right click the file and see what applications Dolphin gives you to open it.

OBSERVED RESULT

Okular appears in the list twice.

EXPECTED RESULT

Okular appears in the list once.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.93.0
KDE Frameworks Version: 5.249.0
Qt Version: 6.7.0
Kernel Version: 6.7.4-arch1-1 (64-bit)
Graphics Platform: Wayland
Comment 1 fanzhuyifan 2024-02-17 18:49:48 UTC
Can reproduce on plasma 6 source build -- okular shows up twice when right clicking .md files in dolphin.

Not sure which component this should be assigned to though.
Comment 2 Nate Graham 2024-02-21 17:08:04 UTC
Can also reproduce.
Comment 3 Harald Sitter 2024-02-21 22:38:28 UTC
One has to wonder if we should propose AliasFor as standard key given the uses that suddenly pop up for it.
Comment 4 Bug Janitor Service 2024-02-21 22:50:47 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1560