Can't open PDF attatchment in geary

Hello,

unfortunately I can’t open PDF attachments in geary. With other file types it works without problems. Saving PDF files is also possible.
I use geary 40.0 under ubuntu 20.04 installed via flatpak.
I hope you have a solution for me.

Greetings Stefan Walder

Hi! :slight_smile:

Can you open the pdf file directly from the file browser (“Files” app on GNOME)? What PDF reader are you using? Since you can open other file types, it sounds like your PDF reader doesn’t “say” it supports PDF file types.

Hi,

I use “evince” for viewing PDF files. With the ubuntu file manager “natilus” there is no problem. I can open the PDF files with a double click. Some time ago there was no problem.
Is there a way to configure what program geary uses for opening PDF files?
Thanks Stefan

Sorry for the delay, I was busy with some other things :slight_smile:

Well Geary already tries opening with the default assigned normally so no configuration should be needed. I tried sending myself a test pdf as mail attachment, then opening it in Geary proposed me a prompt between LibreOffice Impress and Evince (this one shows only once though, as it remembers the choice made), and I was able to get the PDF opened in Evince like that. I’m on Fedora 34 though, not sure if that’s important.

Does running xdg-mime query default application/pdf in a terminal gives you evince?

Can you give the output of the following command, flatpak permissions desktop-used-apps | grep -i geary, which checks which default app is assigned for each file type? For example here it gives me (with other lines): desktop-used-apps application/pdf org.gnome.Geary org.gnome.Evince,3,3 0x00.

Because flatpak applications are sandboxed, they can’t access various things directly like your files or the camera and microphone (unless it asks explicit permissions as visible in GNOME Software, or prompts you to e.g. choose a file). To have a more safe way of letting it access such things, Flatpak is accompagnied by a so-called “portal” that provides those various prompts (e.g. file chooser or saver) that ensures applications can only access what the user has agreed to. So can you provide the output of the following command, G_MESSAGES_DEBUG=all /usr/libexec/xdg-desktop-portal --replace | grep -iE '(handler|pdf)' --context=5, which should show how the portal is handling the request to open the PDF file?

Also, are you using GNOME?

Those few questions are to understand what might be wrong, to diagnosis and hopefully fix the problem. :slight_smile:

Hi,

thanks for your reply.
I hope the following output will help:

stefan@stefan-Inspiron-13-5378:~$ G_MESSAGES_DEBUG=all /usr/libexec/xdg-desktop-portal --replace | grep -iE ‘(handler|pdf)’ --context=5
** (/usr/libexec/xdg-desktop-portal:12822): DEBUG: 22:46:19.358: Checking background permissions
** (/usr/libexec/xdg-desktop-portal:12822): DEBUG: 22:46:19.359: App us.zoom.Zoom is background
** (/usr/libexec/xdg-desktop-portal:12822): DEBUG: 22:46:19.359: permission store: background, app us.zoom.Zoom -> yes
** (/usr/libexec/xdg-desktop-portal:12822): DEBUG: 22:46:19.359: App org.gnome.Geary is active
** (/usr/libexec/xdg-desktop-portal:12822): DEBUG: 22:46:19.359: permission store: background, app org.gnome.Geary -> yes
** (/usr/libexec/xdg-desktop-portal:12822): DEBUG: 22:46:27.903: Content type for file /home/stefan/.var/app/org.gnome.Geary/data/geary/goa_account_1550602475_0/attachments/17568/6620/Rauchwarnmelder Vereinshaus LKG Scheideweg 28 Wartung 2021.05.pdf: application/pdf
** (/usr/libexec/xdg-desktop-portal:12822): DEBUG: 22:46:27.925: Default handler org.gnome.Evince for file, application/pdf
** (/usr/libexec/xdg-desktop-portal:12822): DEBUG: 22:46:27.929: Recommended handlers for file, application/pdf: org.pwmt.zathura-pdf-poppler, pdfarranger, org.gnome.Evince, org.inkscape.Inkscape, net.codeindustry.MasterPDFEditor, com.calibre_ebook.calibre, com.calibre_ebook.calibre.ebook-viewer, com.github.xournalpp.xournalpp, org.gimp.GIMP, google-chrome, libreoffice-draw, display-im6.q16
** (/usr/libexec/xdg-desktop-portal:12822): DEBUG: 22:46:27.930: Found in permission store: handler: evince, count: 5 / 3, always ask: 0
** (/usr/libexec/xdg-desktop-portal:12822): DEBUG: 22:46:27.930: Allowing to skip app chooser: above threshold

(/usr/libexec/xdg-desktop-portal:12822): GLib-GIO-CRITICAL **: 22:46:27.930: g_desktop_app_info_get_string: assertion ‘G_IS_DESKTOP_APP_INFO (info)’ failed
** (/usr/libexec/xdg-desktop-portal:12822): DEBUG: 22:46:27.930: Skipping app chooser
** (/usr/libexec/xdg-desktop-portal:12822): DEBUG: 22:46:27.930: Launching evince file:///home/stefan/.var/app/org.gnome.Geary/data/geary/goa_account_1550602475_0/attachments/17568/6620/Rauchwarnmelder%20Vereinshaus%20LKG%20Scheideweg%2028%20Wartung%202021.05.pdf

(/usr/libexec/xdg-desktop-portal:12822): GLib-GIO-CRITICAL **: 22:46:27.930: g_app_info_launch_uris: assertion ‘G_IS_APP_INFO (appinfo)’ failed
^C
stefan@stefan-Inspiron-13-5378:~$ xdg-mime query default application/pdf
org.gnome.Evince.desktop
stefan@stefan-Inspiron-13-5378:~$ flatpak permissions desktop-used-apps | grep -i geary | grep pdf
desktop-used-apps application/pdf org.gnome.Geary evince,5, 0x00
stefan@stefan-Inspiron-13-5378:~$

There is an error in the output of the xdg-desktop-portal call, but I don’t understand this.

When I call it from the commandline, there is no problem:
stefan@stefan-Inspiron-13-5378:~$ evince /home/stefan/.var/app/org.gnome.Geary/data/geary/goa_account_1550602475_0/attachments/17568/6620/Rauchwarnmelder\ Vereinshaus\ LKG\ Scheideweg\ 28\ Wartung\ 2021.05.pdf

I use ubuntu 20.04 and this I thin also use gnome.

Thanks Stefan

Here the output of first opening a jpeg and then a pdf file:

stefan@stefan-Inspiron-13-5378:~$ G_MESSAGES_DEBUG=all /usr/libexec/xdg-desktop-portal --replace | grep -iE ‘(handler|pdf)’ --context=5
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:54:01.255: App org.gnome.Geary is active
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:54:01.255: permission store: background, app org.gnome.Geary -> yes
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:54:01.255: App org.gnome.Geary is new …skipping

** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:54:06.327: Content type for file /home/stefan/.var/app/org.gnome.Geary/data/geary/goa_account_1550602475_0/attachments/17340/6549/image001.jpg: image/jpeg
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:54:06.343: Default handler org.gnome.gThumb for file, image/jpeg
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:54:06.347: Recommended handlers for file, image/jpeg: org.gimp.GIMP, org.gnome.gThumb, firefox, display-im6.q16, google-chrome, org.gnome.eog, shotwell-viewer
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:54:06.349: Found in permission store: handler: org.gnome.gThumb, count: 7 / 3, always ask: 0
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:54:06.349: Allowing to skip app chooser: above threshold
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:54:06.349: Skipping app chooser
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:54:06.349: Launching org.gnome.gThumb file:///home/stefan/.var/app/org.gnome.Geary/data/geary/goa_account_1550602475_0/attachments/17340/6549/image001.jpg
(/usr/libexec/xdg-desktop-portal:13167): GLib-DEBUG: 22:54:06.350: posix_spawn avoided (automatic reaping requested) (fd close requested)
(gthumb:13207): GLib-GIO-DEBUG: 22:54:06.415: _g_io_module_get_default: Found default implementation local (GLocalVfs) for ‘gio-vfs’

** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:54:31.257: Checking background permissions
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:54:31.259: App us.zoom.Zoom is background
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:54:31.259: permission store: background, app us.zoom.Zoom -> yes
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:54:31.259: App org.gnome.Geary is running
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:54:31.259: permission store: background, app org.gnome.Geary -> yes
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:55:06.768: Content type for file /home/stefan/.var/app/org.gnome.Geary/data/geary/goa_account_1550602475_0/attachments/17340/6552/20210318 Anmeldung Bergische Feierabendmarkt.pdf: application/pdf
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:55:06.770: Default handler org.gnome.Evince for file, application/pdf
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:55:06.777: Recommended handlers for file, application/pdf: org.pwmt.zathura-pdf-poppler, pdfarranger, org.gnome.Evince, org.inkscape.Inkscape, net.codeindustry.MasterPDFEditor, com.calibre_ebook.calibre, com.calibre_ebook.calibre.ebook-viewer, com.github.xournalpp.xournalpp, org.gimp.GIMP, google-chrome, libreoffice-draw, display-im6.q16
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:55:06.780: Found in permission store: handler: evince, count: 5 / 3, always ask: 0
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:55:06.780: Allowing to skip app chooser: above threshold

(/usr/libexec/xdg-desktop-portal:13167): GLib-GIO-CRITICAL **: 22:55:06.780: g_desktop_app_info_get_string: assertion ‘G_IS_DESKTOP_APP_INFO (info)’ failed
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:55:06.780: Skipping app chooser
** (/usr/libexec/xdg-desktop-portal:13167): DEBUG: 22:55:06.780: Launching evince file:///home/stefan/.var/app/org.gnome.Geary/data/geary/goa_account_1550602475_0/attachments/17340/6552/20210318%20Anmeldung%20Bergische%20Feierabendmarkt.pdf

(/usr/libexec/xdg-desktop-portal:13167): GLib-GIO-CRITICAL **: 22:55:06.780: g_app_info_launch_uris: assertion ‘G_IS_APP_INFO (appinfo)’ failed

It’s trying to use evince.desktop which doesn’t exist (as shown with assertion ‘G_IS_DESKTOP_APP_INFO (info)’ failed) which of course doesn’t work - it should be using org.gnome.Evince.desktop (and you’ll note the log observes Default handler org.gnome.Evince)

Congratulations, you have a portal bug!

…but it looks like @mcatanzaro caught it already (№ 480) and was fixed last year

Congratulations, you have a distro bug!

You’ll want to ask Canonical to backport that to Ubuntu 20.04 I guess

As a workaround you could try

$ flatpak permission-reset org.gnome.Geary

Which will reset Geary’s permissions - including what app opens pdfs

I would rebase both xdg-desktop-portal and xdg-desktop-portal-gtk in Ubuntu 20.04 to the latest 1.8.x versions. Both components have had a bit of a rough ride recently, and I’m not surprised you wound up with bad versions. afaik their current releases are both currently in good shape.

Hi,

resetting the permissions with

$ flatpak permission-reset org.gnome.Geary

works for me.
Thanks Stefan

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.