Cannot open PDF attachment with Thunderbird

@jdstrand: following up on this, we ran into problems with this when testing its xdg-desktop-portal support. I filed bug #1868051 to help track this.

When we set GTK_USE_PORTAL=1, Firefox shows only a single option (“System Handler”) to open files and custom URI schemes. This ends up calling the GIO’s g_app_info_launch_default_for_uri API, which does the following:

  1. If there is a .desktop file available that can handle the content type (for local files) or URI scheme, invoke it directly.
  2. If there are no matches, call out to xdg-desktop-portal’s OpenURI API.

When the contents of /var/lib/snapd/desktop/applications is readable, Firefox will attempt to invoke those applications directly. This will of course fail because strictly confined apps can’t invoke other snap apps directly.

We noticed this problem when I was able to have Firefox launch LibreOffice to open a .docx file but Ken wasn’t. The difference between our systems was that Ken had the snap version of LibreOffice installed and I didn’t.

You said you didn’t want to risk breaking apps that might need to read those desktop files for some reason. It’s still not clear whether any such apps exist. Browsers might opportunistically access those desktop files if they are readable (by virtue of /var/lib/snapd/desktop being in $XDG_DATA_DIRS), but I haven’t seen any evidence of them failing if they can’t read them.