xdg-settings set default-url-scheme-handler changes the entry for mime type text/html

Bug #1921497 reported by Bèr Kessels (berkes)
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
xdg-utils (Ubuntu)
New
Undecided
Unassigned

Bug Description

From https://github.com/telegramdesktop/tdesktop/issues/16051

Reproduce:

1. Ensure that `text/html` in *$HOME/.config/mimeapps.list* is set to a known value, e.g. firefox.desktop.
2. Create a .desktop file named *telegram-desktop_telegram-desktop.desktop*. See below for an example file.
3. run `xdg-settings set default-url-scheme-handler tg telegram-desktop_telegram-desktop.desktop`
4. Now `xdg-open` or `gio open` will open any HTML file not in firefox, but with telegram.
5. in *$HOME/.config/mimeapps.list* the entry for `text/html` is changed to `text/html=telegram-desktop_telegram-desktop.desktop`.

Expected behaviour:
HTML files are opened in firefox or the app defined before.

Actual behaviour:
HTML files are opened in Telegram (which cannot handle this).

telegram-desktop is an example, and is how I experienced this issue. I'm not familiar enough with scheme-handlers and xdg-utils to be able to boil down a desktop-file to the bare minimals to reproduce this. Sorry for that.

*telegram-desktop_telegram-desktop.desktop* contents:
```
[Desktop Entry]
X-SnapInstanceName=telegram-desktop
Version=1.0
Name=Telegram Desktop
Comment=Official desktop version of Telegram messaging app
Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/telegram-desktop_telegram-desktop.desktop /snap/bin/telegram-desktop -- %u
Icon=/snap/telegram-desktop/2551/meta/gui/icon.png
Terminal=false
StartupWMClass=TelegramDesktop
Type=Application
Categories=Chat;Network;InstantMessaging;Qt;
MimeType=x-scheme-handler/tg;
Keywords=tg;chat;im;messaging;messenger;sms;tdesktop;
```

I've gotten this file by installing telegram with snap and it is then located at */var/lib/snapd/desktop/applications/telegram-desktop_telegram-desktop.desktop*. I'm not sure if the desktop file works as it references to snap directories that do not exist if telegram-desktop is not installed.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.