Bug 484945

Summary: Duplicate menu entries after editing desktop file
Product: [Applications] kmenuedit Reporter: xiota <kde>
Component: generalAssignee: Oliver Beard <olib141>
Status: RESOLVED FIXED    
Severity: minor CC: olib141
Priority: NOR    
Version First Reported In: 6.0.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description xiota 2024-04-02 20:06:10 UTC
After editing Telegram menu entry (via right click) (eg, to add options), duplicate entries later appear in the menu.

Problem appears to be caused by the filename Telegram has chosen: `org.telegram.desktop.desktop`

The double `.desktop` extention is collapsed when the file is saved to `~/.local/share/applications` as `org.telegram.desktop`.  The mismatched file names are then considered separate entries, and Telegram appears twice in the menu.

Telegram devs consider this a KDE bug and refuse to rename the desktop file.

As far as I can tell, filenames with double `.desktop` extension is not forbidden by XDG Desktop Menu Specification.
Comment 1 Oliver Beard 2025-03-25 16:43:10 UTC
Sounds like someone, somewhere, used QString::indexOf(".desktop") instead of lastIndexOf. 😄
Comment 2 Oliver Beard 2025-03-28 17:00:09 UTC
I cannot reproduce this in git master or 6.3.2 with the telegram-desktop arch package. Is this with the flatpak?
Comment 3 xiota 2025-03-28 21:51:49 UTC
Thanks for looking into it.  This issue can be closed now as resolved/fixed.

I opened the issue a year ago, and KMenuEdit looks much different from back then.  So whatever was causing the problem was probably revised away along with other changes.

I tested a moment ago with a file named `test.desktop.desktop`, and KMenuEdit 6.3.3 seems to handle it correctly.  The problem had occurred with `extra/telegram-desktop`.  I rarely edit menu items, and had added the problem file to the package manager ignore list.
Comment 4 xiota 2025-03-28 22:01:42 UTC
I downloaded KMenuEdit 6.0.3 from https://archive.archlinux.org/repos/2024/04/02/extra/os/x86_64/kmenuedit-6.0.3-1-x86_64.pkg.tar.zst to test.  It seems to behave correctly.  Could the problem have been from something outside of KMenuEdit, like a different KDE or Qt6 component?
Comment 5 Oliver Beard 2025-03-29 13:49:32 UTC
(In reply to xiota from comment #4)
> Could the problem have been from something outside of KMenuEdit, like a different KDE or Qt6 component?

It could have been in KConfig/KDesktopFile.

I'll close for now, thanks for following-up.