Accessing previously saved files in a sandboxed Flatpak app without re-prompting the user

Hi,

I’m developing an application that stores recently opened projects as a list of URIs in GSettings. When the app starts, I populate a menu with these recent projects, allowing the user to click on one to reopen it.

However, if the project was saved using a Gtk.FileDialog, the file access was only temporarily granted through the XDG Document Portal. As a result, when reopening the app, I no longer have access to the file — even though I still have its URI.

Is there a recommended way to reopen these previously saved JSON files without requesting broad filesystem permissions, and without prompting the user again with a Gtk.FileDialog?

Thanks in advance for your help!

Best regards,
Matthieu Lorier

Hi,

I’m not a flatpak expert, but I remember there is a permissions store that keep the files authorizations in a cache, when you use the Document portal (i.e. Gtk.FileDialog).

Have a look at what flatpak permission-show returns.

Thank you for the response!

1 Like