2

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.

However, for .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:

enter image description here

When I click that link, I am now presented with this dialog (this is the new behavior I mentioned):

enter image description here

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:

enter image description here

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.

I reinstalled 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:

How to associate a new (custom) mime type with files (based on file extension)?

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.)

-1

As I pointed out in this answer, I believe you have managed to change your system defaults. Try in a fresh system, and if it works, just reinstall the packages reported by paccheck.

I installed riot-desktop and sent a .pub file and I was prompted to Open or Save file via a falkon (my default browser) dialog. Once I chose Save As, I got the KDE save as dialog. Here is a screenshot

enter image description here

My guess is this problem is not related to electron-based apps as you think. To prove this, upload your .pub file to a local apache installation or any web server and open the link with your default browser and report back.

|improve this answer|||||
  • The other question is not relevant to this one. These are two different Arch installs, with two different mime problems. This system does not have the errors I reported in the other question. I would like to diagnose and fix this issue. Thanks. – MountainX Feb 1 at 19:20
  • I updated the question with new info. – MountainX Feb 2 at 1:38
  • Sorry for the miscommunication. I thought you said is works for you. This does not work for me even with a new user account on a new device. – MountainX Feb 3 at 0:51
  • I updated the question again with more information. – MountainX Feb 3 at 1:12
  • That's not correct behavior. It should present you with the KDE File Save dialog. That's what is does for me with .csv files, .png files, etc. – MountainX Feb 3 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.