URL handler and xdg-mime not working when Exec line contains quoted path
When the command file path in the
Exec field of a desktop file is wrapped in double quotes, xdg-mime and the URL handling seem to be unable to deal with it.
[Desktop Entry] Name=Slippi Launcher Comment=Slippi Desktop App for browsing and playing replays. Exec="/home/haystack/source/Slippi-Launcher-1.4.5-x86_64.AppImage" %U Terminal=false Type=Application Icon=appimagekit-slippi-desktop-app StartupWMClass=Slippi Launcher X-AppImage-Version=1.4.5 MimeType=x-scheme-handler/slippi; Categories=Development; X-AppImage-BuildId=1K1bOeuJzPhoG9WcseHboZyGhZK X-Desktop-File-Install-Version=0.24 X-AppImage-Comment=Generated by /tmp/.mount_SlippipSpjHL/AppRun TryExec=/home/haystack/source/Slippi-Launcher-1.4.5-x86_64.AppImage
❯ xdg-settings set default-url-scheme-handler slippi appimagekit-slippi-desktop-app.desktop which: no Slippi-Launcher-1.4.5-x86_64.AppImage" in (./"/home/haystack/source)
The desktop entry spec seems to say that quoting the path should be fine. Based on this it seems that xdg-utils is not correctly implementing the desktop file specification. Desktop files with a quoted exec path usually work fine.
electron-builder also seems to (quite reasonably) create desktop files with a quoted file path, but then they are broken with xdg-utils (URL handling won't work, nor will xdg-mime). If there are spaces in the file path or any other special character that needs escaping, then backslashes would have to be inserted which is much more inconvenient than quoting the whole path, which works pretty much everywhere else in GNU/Linux.
I believe this is something that should be fixed on xdg-utils' end, not in electron-builder or any other program that quotes the executable paths in desktop entries.