I'm running Riot.im (an Electron desktop app) in KDE (on Arch Linux). For many file types, when I click a link to download the file in Riot, the file is downloaded as expected. I am presented with KDE's File Save dialog.
.pub files (and possible a few other mime-types), they are opened by an application instead of being downloaded. For
.pub files, unfortunately, that application is Okular, which is completely inappropriate.
Riot's support denies that anything in Riot is controlling this behavior. They point the finger at my operating system. I would like to understand how KDE is making the decision to open the link in an app vs downloading it, and I would like to force these
.pub links to download.
Here is what a download link looks like in Riot:
When I click that link, I am now presented with this dialog (this is the new behavior I mentioned):
Notice that the file name is actually
id_ed25519.pub but the file name in the KIO dialog is a string of random characters (like QRRdfN...Mm).
Also notice that this dialog does not offer the option to save the file association (as if typically the case with this type of dialog in KDE).
Right clicking on the download links shows this information:
If I open that link in Firefox, I am shown a File Save Dialog and I can download the file as expected. Riot's behavior is different (and undesirable).
My goal is to make KDE present a File Save dialog for
.pub links in Riot.im. How can I do that?
EDIT: Here is new information from some troubleshooting.
I checked all my packages for corruption with this command. There were no corrupt packages.
paccheck --md5sum --quiet
Next I reinstalled KDE & kde-applications. I selected cronie from Repository core (the default):
pacman -Syu plasma-meta kde-applications-meta There are 2 providers available for cron: Repository core: cronie
Reinstalling KDE did change the behavior described above, but not in the desired way. (It made things worse because I cannot properly save a public key now.) When I clicked that same download link in Riot.im, KDE opened the file with Okular. That's neither the correct app for a public key nor the desired action (to download and save the file). However, I believe that is the normal / default behavior. (It's the behavior I had initially, before I start trying to solve this problem.)
As a next step, I opened KDE System Settings > Applications > File Associations and searched for
pub. The only exact match is application/vnd.ms-publisher. Okular, Gwenview and Libre Office Draw were listed as applications, along with Kate. I removed Okular, Gwenview and Libre Office Draw, leaving only Kate. I saved the settings. I checked that they were saved (yes) and that the same associations were shown in Dolphin (they were).
Next I tested Riot.im again, and it still opens the public key link with Okular.
kdegraphics-meta (the meta package containing Okular), checked mime-type file associations again after reinstalling, and then tried the download link in Riot.im. Once again, KDE opens the link in Okular. Okular is not listed in the Applications for
.pub files any longer.
Where is this association coming from? I do not find it via xdg-mime queries (as root or the user):
# xdg-mime query filetype id_rsa_test.pub text/plain # xdg-mime query default text/plain atom.desktop $ xdg-mime query filetype id_rsa_test.pub text/plain $ xdg-mime query default text/plain org.kde.kate.desktop
EDIT 2: I have again been able to change Riot's mime-type behavior using the steps in this question:
However, as stated there, "Afer the xdg-mime default command shown above, the Okular association is gone, but nothing has replaced it." That's better that being forced to open public key files in Okular, but it also puts me back at square one. It does show that Riot responds to the system's mime-types. And it reinforces my belief (and the response of Riot support) that this behavior is coming from the system's mime-type configuration. My system is not corrupt or broken in a way that would require reinstallation. I am simply missing the correct mime configuration for
.pub files in the place Riot is looking. (I dont' know the solution for that, but I believe the evidence shows it can be solve through further mime-type configuration.)
Here is another piece of evidence supporting my view. Riot.im will download
.csv files correctly. This show that it is possible to have my desired behavior, and that the behavior depends on the mime-type.
With the new troubleshooting information, the goals for this question remain the same as stated above:
My goal is to make KDE present a File Save dialog for download links, especially public key files. (And I definitely do not want those opening in Okular.)