I tracked this down and have a fix (debdiff attached), tested on Ubuntu
26.04 with xdg-desktop-portal 1.21.1+ds-1ubuntu3.1 and the Firefox snap.
Root cause
----------
With the snaps patchset, the permission store translates app IDs to permission
IDs in SetPermission/GetPermission/DeletePermission
(permissions_id_for_app_id()), but Lookup returns the whole table keyed by the
permission ID. src/open-uri.c still uses xdp_app_info_get_id() for the
desktop-used-apps table:
- get_latest_choice_info() calls Lookup and compares each key with the app ID
("firefox_firefox"), but the key is "snap.firefox", so the stored choice is
never found and the app chooser is always shown.
- update_permissions_store() uses the same lookup, so it never finds the
previous choice either and always writes count 1. The store saves it as
"snap.firefox" again, so the counter never reaches the threshold.
dbus-monitor confirms it: the portal calls SetPermission(desktop-used-
apps, application/pdf, "firefox_firefox", ['org.gnome.Papers','1','3']),
and the Changed signal shows the entry as 'snap.firefox':
['org.gnome.Papers','1','3']. Setting the entry to 3/3 by hand does not
help, which matches the reports above.
The fix uses xdp_app_info_get_permissions_id() for both permission store
accesses in open-uri.c, the same way the other portals (camera, xdp-
permissions) already do. The app ID is still passed to the AppChooser
backend, which expects the desktop ID.
[ Impact ]
Snapped applications (Firefox, Thunderbird, ...) that open files or URIs
through the OpenURI portal get the app chooser dialog every time, even when the
user picks the same application over and over. This is a regression from 25.10.
[ Test Plan ]
1. On 26.04, open a downloaded PDF from the Firefox snap with "Open with system
handler".
2. Pick the same application (e.g. Document Viewer) in the app chooser.
3. Repeat. Without the fix, the dialog appears every time and
gdbus call --session --dest org.freedesktop.impl.portal.PermissionStore
--object-path /org/freedesktop/impl/portal/PermissionStore --method
org.freedesktop.impl.portal.PermissionStore.Lookup desktop-used-apps
application/pdf
shows 'snap.firefox': [..., '1', '3'] every time.
4. With the fix, the counter goes up to 3/3 and from then on the file opens
directly, without the dialog.
5. Regression check: a non-sandboxed or flatpak app still remembers its choice
(for these the app ID and the permission ID are identical).
[ Where problems could occur ]
The change only affects which ID open-uri uses as the key in the
desktop-used-apps permission table. For flatpak and host apps the permission ID
equals the app ID, so nothing changes for them. For snaps, choices that were
stored under the old keys before the fix are not lost: they were already stored
as snap.<name> because of the store's translation. If something went wrong, the
worst case is the current behaviour (the chooser is shown again).
Upstream: this belongs to the snap permission-ID work in
https://github.com/flatpak/xdg-desktop-portal/pull/1764. open-uri.c
needs the same change there.
** Patch added: "debdiff fixing the app chooser for snaps
(1.21.1+ds-1ubuntu3.2)"
https://bugs.launchpad.net/ubuntu/+source/xdg-desktop-portal/+bug/2152906/+attachment/6005359/+files/xdg-desktop-portal_1.21.1+ds-1ubuntu3.2.debdiff
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2152906
Title:
Firefox PDF opening with default system application looks different in
Ubuntu 26.04 compared to 25.10
To manage notifications about this bug go to:
https://bugs.launchpad.net/xdg-desktop-portal/+bug/2152906/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs